From patchwork Sat Nov 13 16:02:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 322442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oADG7ls7032675 for ; Sat, 13 Nov 2010 16:07:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754247Ab0KMQHq (ORCPT ); Sat, 13 Nov 2010 11:07:46 -0500 Received: from mail-gw0-f46.google.com ([74.125.83.46]:60804 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752618Ab0KMQHq (ORCPT ); Sat, 13 Nov 2010 11:07:46 -0500 Received: by gwj17 with SMTP id 17so418728gwj.19 for ; Sat, 13 Nov 2010 08:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=pgZGLT11ZjrGbchZz+fI1fCtyNOA5d14cotKSNZAYUU=; b=H0hJF21T6gfIHBbu9I7OuOwbtSm1kvs6ooOwQMAfAgBJwuJ11eEd1tFDQyNlYtsd3T AC3kmcHdkx1IyMVTAPWg1DZ6L1eXyzn7BNZ8FU5QVHNnENd+aGnfN+vZ0Jf5Cl392iz5 ICn+XcC9ixRhQ+9C3s/XxxOlzqRC5aBwv35iM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=LKnnwKETYuKJCoc6PGMW/RaSR47HxKpNJ9KZlgY53S7tehj24W/DK0SP8bDY3U34wy wirl/9kix9+M3jrZo5nzfJ9X61rwrj2j+blf+5uP0Ce2NvlRK3qHB8o+ZyIf5QZh2Zqq QTxEFRoezeGAT4q/oG9a6gHj6epZLTQPMMtTU= Received: by 10.151.12.3 with SMTP id p3mr6219025ybi.237.1289664465258; Sat, 13 Nov 2010 08:07:45 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id p20sm1566394ybe.5.2010.11.13.08.07.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 08:07:44 -0800 (PST) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Misc. cleanup in cifsacl handling Date: Sat, 13 Nov 2010 10:02:18 -0600 Message-Id: <1289664138-16108-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 13 Nov 2010 16:07:48 +0000 (UTC) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index b54fec0..c6ebea0 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -726,7 +726,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, } /* Convert mode bits to an ACL so we can update the ACL on the server */ -int mode_to_acl(struct inode *inode, const char *path, __u64 nmode) +int mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode) { int rc = 0; __u32 secdesclen = 0; diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index a47ffc2..db961dc 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -133,7 +133,7 @@ extern int cifs_get_inode_info_unix(struct inode **pinode, extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, struct inode *inode, const char *path, const __u16 *pfid); -extern int mode_to_acl(struct inode *inode, const char *path, __u64); +extern int mode_to_cifs_acl(struct inode *inode, const char *path, __u64); extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *, const char *, u32 *); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index b857ce5..6e8477e 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -106,7 +106,7 @@ static inline int cifs_get_disposition(unsigned int flags) static inline int cifs_open_inode_helper(struct inode *inode, struct cifsTconInfo *pTcon, __u32 oplock, FILE_ALL_INFO *buf, - char *full_path, int xid) + char *full_path, int xid, const __u16 *pfid) { struct cifsInodeInfo *pCifsInode = CIFS_I(inode); struct timespec temp; @@ -144,7 +144,7 @@ client_can_cache: xid); else rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb, - xid, NULL); + xid, pfid); cifs_set_oplock_level(pCifsInode, oplock); @@ -448,7 +448,8 @@ int cifs_open(struct inode *inode, struct file *file) goto out; } - rc = cifs_open_inode_helper(inode, tcon, oplock, buf, full_path, xid); + rc = cifs_open_inode_helper(inode, tcon, oplock, buf, full_path, xid, + &netfid); if (rc != 0) goto out; diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index ff7d299..35014dc 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -689,8 +689,13 @@ int cifs_get_inode_info(struct inode **pinode, #ifdef CONFIG_CIFS_EXPERIMENTAL /* fill in 0777 bits from ACL */ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { - cFYI(1, "Getting mode bits from ACL"); - cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, pfid); + rc = cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, + pfid); + if (rc) { + cFYI(1, "%s: Getting ACL failed with error: %d", + __func__, rc); + goto cgii_exit; + } } #endif @@ -2047,7 +2052,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifsInodeInfo *cifsInode = CIFS_I(inode); char *full_path = NULL; - int rc = -EACCES; + int rc; __u32 dosattr = 0; __u64 mode = NO_CHANGE_64; @@ -2113,11 +2118,15 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) } if (attrs->ia_valid & ATTR_MODE) { - rc = 0; #ifdef CONFIG_CIFS_EXPERIMENTAL - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) - rc = mode_to_acl(inode, full_path, mode); - else + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { + rc = mode_to_cifs_acl(inode, full_path, mode); + if (rc) { + cFYI(1, "%s: Setting ACL failed with error: %d", + __func__, rc); + goto cifs_setattr_exit; + } + } #endif if (((mode & S_IWUGO) == 0) && (cifsInode->cifsAttrs & ATTR_READONLY) == 0) {