Merge git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
[pandora-kernel.git] / fs / read_write.c
index 9c04852..e757ef2 100644 (file)
@@ -124,7 +124,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
 {
        loff_t retval;
 
-       lock_kernel();
+       mutex_lock(&file->f_dentry->d_inode->i_mutex);
        switch (origin) {
                case SEEK_END:
                        offset += i_size_read(file->f_path.dentry->d_inode);
@@ -145,7 +145,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
                retval = offset;
        }
 out:
-       unlock_kernel();
+       mutex_unlock(&file->f_dentry->d_inode->i_mutex);
        return retval;
 }
 EXPORT_SYMBOL(default_llseek);
@@ -156,7 +156,6 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
 
        fn = no_llseek;
        if (file->f_mode & FMODE_LSEEK) {
-               fn = default_llseek;
                if (file->f_op && file->f_op->llseek)
                        fn = file->f_op->llseek;
        }
@@ -311,7 +310,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
                else
                        ret = do_sync_read(file, buf, count, pos);
                if (ret > 0) {
-                       fsnotify_access(file->f_path.dentry);
+                       fsnotify_access(file);
                        add_rchar(current, ret);
                }
                inc_syscr(current);
@@ -367,7 +366,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
                else
                        ret = do_sync_write(file, buf, count, pos);
                if (ret > 0) {
-                       fsnotify_modify(file->f_path.dentry);
+                       fsnotify_modify(file);
                        add_wchar(current, ret);
                }
                inc_syscw(current);
@@ -675,9 +674,9 @@ out:
                kfree(iov);
        if ((ret + (type == READ)) > 0) {
                if (type == READ)
-                       fsnotify_access(file->f_path.dentry);
+                       fsnotify_access(file);
                else
-                       fsnotify_modify(file->f_path.dentry);
+                       fsnotify_modify(file);
        }
        return ret;
 }