]> Pileus Git - ~andy/linux/blobdiff - fs/xattr.c
sit: rename rtnl functions for consistency
[~andy/linux] / fs / xattr.c
index f7f7f09b0b4166978f567efc60c07f585462a789..e21c119f4f99d8512208a9c08983dd5f9c25d821 100644 (file)
@@ -296,11 +296,13 @@ vfs_removexattr(struct dentry *dentry, const char *name)
        if (error)
                return error;
 
+       mutex_lock(&inode->i_mutex);
        error = security_inode_removexattr(dentry, name);
-       if (error)
+       if (error) {
+               mutex_unlock(&inode->i_mutex);
                return error;
+       }
 
-       mutex_lock(&inode->i_mutex);
        error = inode->i_op->removexattr(dentry, name);
        mutex_unlock(&inode->i_mutex);
 
@@ -403,22 +405,20 @@ SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname,
 SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
                const void __user *,value, size_t, size, int, flags)
 {
-       int fput_needed;
-       struct file *f;
+       struct fd f = fdget(fd);
        struct dentry *dentry;
        int error = -EBADF;
 
-       f = fget_light(fd, &fput_needed);
-       if (!f)
+       if (!f.file)
                return error;
-       dentry = f->f_path.dentry;
-       audit_inode(NULL, dentry);
-       error = mnt_want_write_file(f);
+       dentry = f.file->f_path.dentry;
+       audit_inode(NULL, dentry, 0);
+       error = mnt_want_write_file(f.file);
        if (!error) {
                error = setxattr(dentry, name, value, size, flags);
-               mnt_drop_write_file(f);
+               mnt_drop_write_file(f.file);
        }
-       fput_light(f, fput_needed);
+       fdput(f);
        return error;
 }
 
@@ -502,16 +502,14 @@ SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
 SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
                void __user *, value, size_t, size)
 {
-       int fput_needed;
-       struct file *f;
+       struct fd f = fdget(fd);
        ssize_t error = -EBADF;
 
-       f = fget_light(fd, &fput_needed);
-       if (!f)
+       if (!f.file)
                return error;
-       audit_inode(NULL, f->f_path.dentry);
-       error = getxattr(f->f_path.dentry, name, value, size);
-       fput_light(f, fput_needed);
+       audit_inode(NULL, f.file->f_path.dentry, 0);
+       error = getxattr(f.file->f_path.dentry, name, value, size);
+       fdput(f);
        return error;
 }
 
@@ -583,16 +581,14 @@ SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
 
 SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
 {
-       int fput_needed;
-       struct file *f;
+       struct fd f = fdget(fd);
        ssize_t error = -EBADF;
 
-       f = fget_light(fd, &fput_needed);
-       if (!f)
+       if (!f.file)
                return error;
-       audit_inode(NULL, f->f_path.dentry);
-       error = listxattr(f->f_path.dentry, list, size);
-       fput_light(f, fput_needed);
+       audit_inode(NULL, f.file->f_path.dentry, 0);
+       error = listxattr(f.file->f_path.dentry, list, size);
+       fdput(f);
        return error;
 }
 
@@ -652,22 +648,20 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
 
 SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
 {
-       int fput_needed;
-       struct file *f;
+       struct fd f = fdget(fd);
        struct dentry *dentry;
        int error = -EBADF;
 
-       f = fget_light(fd, &fput_needed);
-       if (!f)
+       if (!f.file)
                return error;
-       dentry = f->f_path.dentry;
-       audit_inode(NULL, dentry);
-       error = mnt_want_write_file(f);
+       dentry = f.file->f_path.dentry;
+       audit_inode(NULL, dentry, 0);
+       error = mnt_want_write_file(f.file);
        if (!error) {
                error = removexattr(dentry, name);
-               mnt_drop_write_file(f);
+               mnt_drop_write_file(f.file);
        }
-       fput_light(f, fput_needed);
+       fdput(f);
        return error;
 }
 
@@ -852,7 +846,7 @@ static int __simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
                              const void *value, size_t size, int flags)
 {
        struct simple_xattr *xattr;
-       struct simple_xattr *uninitialized_var(new_xattr);
+       struct simple_xattr *new_xattr = NULL;
        int err = 0;
 
        /* value == NULL means remove */