From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: [PATCH 03/13] cifs: allow get_cifs_acl to be called without an inode Date: Mon, 11 May 2009 16:24:22 -0400 Message-ID: <1242073472-7100-4-git-send-email-jlayton@redhat.com> References: <1242073472-7100-1-git-send-email-jlayton@redhat.com> Cc: linux-fsdevel@vger.kernel.org To: linux-cifs-client@lists.samba.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55618 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753869AbZEKUYf (ORCPT ); Mon, 11 May 2009 16:24:35 -0400 In-Reply-To: <1242073472-7100-1-git-send-email-jlayton@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: We'll need this later when we restructure cifs_get_inode_info. Signed-off-by: Jeff Layton --- 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