[linux-cifs-client] [PATCH 03/13] cifs: allow get_cifs_acl to be called without an inode

Jeff Layton jlayton at redhat.com
Mon May 11 20:24:22 GMT 2009


We'll need this later when we restructure cifs_get_inode_info.

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 fs/cifs/cifsacl.c |   25 ++++++-------------------
 1 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 57ecdc8..82fc4a9 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -555,37 +555,24 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
 
 /* Retrieve an ACL from the server */
 static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
-				       const char *path, const __u16 *pfid)
+				      const char *path, const __u16 *pfid)
 {
 	struct cifsFileInfo *open_file = NULL;
-	bool unlock_file = false;
 	int xid;
 	int rc = -EIO;
 	__u16 fid;
-	struct super_block *sb;
-	struct cifs_sb_info *cifs_sb;
 	struct cifs_ntsd *pntsd = NULL;
+	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 
 	cFYI(1, ("get mode from ACL for %s", path));
 
-	if (inode == NULL)
-		return NULL;
-
 	xid = GetXid();
-	if (pfid == NULL)
-		open_file = find_readable_file(CIFS_I(inode));
-	else
+	if (pfid)
 		fid = *pfid;
-
-	sb = inode->i_sb;
-	if (sb == NULL) {
-		FreeXid(xid);
-		return NULL;
-	}
-	cifs_sb = CIFS_SB(sb);
+	else if (inode)
+		open_file = find_readable_file(CIFS_I(inode));
 
 	if (open_file) {
-		unlock_file = true;
 		fid = open_file->netfid;
 	} else if (pfid == NULL) {
 		int oplock = 0;
@@ -603,7 +590,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
 
 	rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
 	cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen));
-	if (unlock_file == true) /* find_readable_file increments ref count */
+	if (open_file) /* find_readable_file increments ref count */
 		atomic_dec(&open_file->wrtPending);
 	else if (pfid == NULL) /* if opened above we have to close the handle */
 		CIFSSMBClose(xid, cifs_sb->tcon, fid);
-- 
1.6.0.6



More information about the linux-cifs-client mailing list