]> err.no Git - linux-2.6/blobdiff - fs/nfs/inode.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[linux-2.6] / fs / nfs / inode.c
index fc0f12ba89ccfe7ce88d1a7f344f80fe662f4119..6391d89642144366591df7e7c0e6733b12916899 100644 (file)
@@ -1009,13 +1009,18 @@ void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
        spin_unlock(&inode->i_lock);
 }
 
-struct nfs_open_context *nfs_find_open_context(struct inode *inode, int mode)
+/*
+ * Given an inode, search for an open context with the desired characteristics
+ */
+struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode)
 {
        struct nfs_inode *nfsi = NFS_I(inode);
        struct nfs_open_context *pos, *ctx = NULL;
 
        spin_lock(&inode->i_lock);
        list_for_each_entry(pos, &nfsi->open_files, list) {
+               if (cred != NULL && pos->cred != cred)
+                       continue;
                if ((pos->mode & mode) == mode) {
                        ctx = get_nfs_open_context(pos);
                        break;
@@ -1683,8 +1688,7 @@ static void nfs_kill_super(struct super_block *s)
 
        rpciod_down();          /* release rpciod */
 
-       if (server->hostname != NULL)
-               kfree(server->hostname);
+       kfree(server->hostname);
        kfree(server);
 }
 
@@ -1903,8 +1907,7 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen)
                        return ERR_PTR(-ENOMEM);
        }
        if (copy_from_user(dst, src->data, maxlen)) {
-               if (p != NULL)
-                       kfree(p);
+               kfree(p);
                return ERR_PTR(-EFAULT);
        }
        dst[maxlen] = '\0';
@@ -1995,10 +1998,8 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
 out_err:
        s = (struct super_block *)p;
 out_free:
-       if (server->mnt_path)
-               kfree(server->mnt_path);
-       if (server->hostname)
-               kfree(server->hostname);
+       kfree(server->mnt_path);
+       kfree(server->hostname);
        kfree(server);
        return s;
 }
@@ -2018,8 +2019,7 @@ static void nfs4_kill_super(struct super_block *sb)
 
        destroy_nfsv4_state(server);
 
-       if (server->hostname != NULL)
-               kfree(server->hostname);
+       kfree(server->hostname);
        kfree(server);
 }