From patchwork Mon May 11 20:24:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 23063 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4BKP4UZ004139 for ; Mon, 11 May 2009 20:25:05 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 68BB9163C89 for ; Mon, 11 May 2009 20:24:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx2.redhat.com (mx2.redhat.com [66.187.237.31]) by lists.samba.org (Postfix) with ESMTP id 54BD5163BCF for ; Mon, 11 May 2009 20:24:10 +0000 (GMT) Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4BKOZdn022947; Mon, 11 May 2009 16:24:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4BKOYdN013446; Mon, 11 May 2009 16:24:34 -0400 Received: from localhost.localdomain (vpn-12-106.rdu.redhat.com [10.11.12.106]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4BKOWM7020997; Mon, 11 May 2009 16:24:34 -0400 From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Mon, 11 May 2009 16:24:22 -0400 Message-Id: <1242073472-7100-4-git-send-email-jlayton@redhat.com> In-Reply-To: <1242073472-7100-1-git-send-email-jlayton@redhat.com> References: <1242073472-7100-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Cc: linux-fsdevel@vger.kernel.org Subject: [linux-cifs-client] [PATCH 03/13] cifs: allow get_cifs_acl to be called without an inode X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org 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);