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

Jeff Layton <[email protected]>
Newsgroups gmane.linux.file-systems,gmane.linux.file-systems.cifs
Message-ID <[email protected]>
We'll need this later when we restructure cifs_get_inode_info.

Signed-off-by: Jeff Layton <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.