From patchwork Wed Mar 9 04:52:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 620341 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 p294nv9x004681 for ; Wed, 9 Mar 2011 04:49:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932181Ab1CIEt4 (ORCPT ); Tue, 8 Mar 2011 23:49:56 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:47315 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932179Ab1CIEt4 (ORCPT ); Tue, 8 Mar 2011 23:49:56 -0500 Received: by iwn34 with SMTP id 34so158967iwn.19 for ; Tue, 08 Mar 2011 20:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=x8yA2yIhRBJhx4gbMHhjST78s19RJi92RzGNZugGLRY=; b=A6dsX+Dqos0Q/MAiVh3HeenmHuPhfF2F/SOlSixECsL0ozYu/umjUmCotowLFpPngL 1Mq+k0pWzxk5lOrqCMVOJys7U6g3yZNqJkuA2wKbgSiRbh60+TUPRysUju7kvNHVeNBS OsyT7xCApDCqJJIBPZesZiCmheWInDyIM5Muc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=FMIT3qfWhBF6p49Jo9McInBgnnyrlaS3qry51bQAH3p65PYZreVHIBNUfF+dHW9gJn BI0JoMf1eTY7STJ+JMj1gKnq/7l19tUDP5eVGbgK88WWYgb4DP0IhbrKz/2J2M2GX+gt el7/5w0PerRnL57HDdWHst7YRC/2lGNM0AduU= Received: by 10.42.148.74 with SMTP id q10mr7496455icv.286.1299646194980; Tue, 08 Mar 2011 20:49:54 -0800 (PST) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id 8sm1193410iba.22.2011.03.08.20.49.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 20:49:54 -0800 (PST) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH] cifs: Allow to set extended attribute cifs_acl (try #2) Date: Tue, 8 Mar 2011 22:52:13 -0600 Message-Id: <1299646333-9142-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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Mar 2011 04:49:58 +0000 (UTC) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 555e8c5..a14e45d 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -688,7 +688,7 @@ out: } /* Set an ACL on the server */ -static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, +int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, struct inode *inode, const char *path) { struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 03b9344..095cec7 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -143,6 +143,8 @@ extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, 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 *); +extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *, + const char *); extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, const char *); diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 2ed33a2..757873f 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c @@ -112,6 +112,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, struct cifs_tcon *pTcon; struct super_block *sb; char *full_path; + struct cifs_ntsd *pacl; if (direntry == NULL) return -EIO; @@ -166,6 +167,21 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, (__u16)value_size, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, + strlen(CIFS_XATTR_CIFS_ACL)) == 0) { + pacl = kmalloc(value_size, GFP_KERNEL); + if (!pacl) { + cFYI(1, "%s: Can't allocate memory for ACL", + __func__); + rc = -ENOMEM; + } else { + memcpy(pacl, ea_value, value_size); + rc = set_cifs_acl(pacl, value_size, + direntry->d_inode, full_path); + if (rc == 0) /* force revalidate of the inode */ + CIFS_I(direntry->d_inode)->time = 0; + kfree(pacl); + } } else { int temp; temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,