diff mbox

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

Message ID 1242073472-7100-4-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton May 11, 2009, 8:24 p.m. UTC
We'll need this later when we restructure cifs_get_inode_info.

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

Patch

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);