From patchwork Wed Jan 26 01:12:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 507501 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0Q0chZL027709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 26 Jan 2011 00:39:03 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PhtP0-0006zA-8X; Wed, 26 Jan 2011 00:38:26 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PhtOy-0006yy-LV for v9fs-developer@lists.sourceforge.net; Wed, 26 Jan 2011 00:38:24 +0000 X-ACL-Warn: Received: from e4.ny.us.ibm.com ([32.97.182.144]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) id 1PhtOx-0003e8-FY for v9fs-developer@lists.sourceforge.net; Wed, 26 Jan 2011 00:38:24 +0000 Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0Q0K3BY015942 for ; Tue, 25 Jan 2011 19:20:05 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 70ACE4DE803B for ; Tue, 25 Jan 2011 19:34:47 -0500 (EST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0Q0cHuf086414 for ; Tue, 25 Jan 2011 19:38:17 -0500 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0Q0cGwV011924 for ; Tue, 25 Jan 2011 17:38:16 -0700 Received: from localhost.localdomain (elm3c187.beaverton.ibm.com [9.47.69.187]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p0Q0cG7u011885; Tue, 25 Jan 2011 17:38:16 -0700 From: "Venkateswararao Jujjuri (JV)" To: v9fs-developer@lists.sourceforge.net Date: Tue, 25 Jan 2011 17:12:42 -0800 Message-Id: <1296004362-25306-1-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 X-Content-Scanned: Fidelis XPS MAILER X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1PhtOx-0003e8-FY Cc: linux-fsdevel@vger.kernel.org Subject: [V9fs-developer] [PATCH 4/5] [fs/9P] Add acl mount option X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 26 Jan 2011 00:39:04 +0000 (UTC) diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 0a2e480..48be5c3 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c @@ -59,7 +59,7 @@ int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) struct v9fs_session_info *v9ses; v9ses = v9fs_inode2v9ses(inode); - if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) { + if ((v9ses->flags & V9FS_ACL_MASK) != V9FS_ACL_ON) { set_cached_acl(inode, ACL_TYPE_DEFAULT, NULL); set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); return 0; @@ -104,9 +104,9 @@ int v9fs_check_acl(struct inode *inode, int mask, unsigned int flags) return -ECHILD; v9ses = v9fs_inode2v9ses(inode); - if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) { + if ((v9ses->flags & V9FS_ACL_MASK) != V9FS_ACL_ON) { /* - * On access = client mode get the acl + * On access = client and acl = on mode get the acl * values from the server */ return 0; @@ -264,7 +264,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, /* * We allow set/get/list of acl when access=client is not specified */ - if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) + if ((v9ses->flags & V9FS_ACL_MASK) != V9FS_ACL_ON) return v9fs_remote_get_acl(dentry, name, buffer, size, type); acl = v9fs_get_cached_acl(dentry->d_inode, type); @@ -315,7 +315,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, * set the attribute on the remote. Without even looking at the * xattr value. We leave it to the server to validate */ - if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) + if ((v9ses->flags & V9FS_ACL_MASK) != V9FS_ACL_ON) return v9fs_remote_set_acl(dentry, name, value, size, flags, type); diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index d34f293..f936433 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -55,7 +55,7 @@ enum { /* Cache options */ Opt_cache_loose, Opt_fscache, /* Access options */ - Opt_access, + Opt_access, Opt_acl, /* Error token */ Opt_err }; @@ -73,6 +73,7 @@ static const match_table_t tokens = { {Opt_fscache, "fscache"}, {Opt_cachetag, "cachetag=%s"}, {Opt_access, "access=%s"}, + {Opt_acl, "acl=%s"}, {Opt_err, NULL} }; @@ -194,13 +195,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) else if (strcmp(s, "any") == 0) v9ses->flags |= V9FS_ACCESS_ANY; else if (strcmp(s, "client") == 0) { -#ifdef CONFIG_9P_FS_POSIX_ACL v9ses->flags |= V9FS_ACCESS_CLIENT; -#else - P9_DPRINTK(P9_DEBUG_ERROR, - "Not defined CONFIG_9P_FS_POSIX_ACL. " - "Ignoring access=client option\n"); -#endif } else { v9ses->flags |= V9FS_ACCESS_SINGLE; v9ses->uid = simple_strtoul(s, &e, 10); @@ -210,6 +205,27 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) kfree(s); break; + case Opt_acl: + s = match_strdup(&args[0]); + if (!s) { + ret = -ENOMEM; + P9_DPRINTK(P9_DEBUG_ERROR, + "problem allocating copy of acl arg\n"); + goto free_and_return; + } + v9ses->flags &= ~V9FS_ACL_MASK; + if (strcmp(s, "on") == 0) { +#ifdef CONFIG_9P_FS_POSIX_ACL + v9ses->flags |= V9FS_ACL_ON; +#else + P9_DPRINTK(P9_DEBUG_ERROR, + "Not defined CONFIG_9P_FS_POSIX_ACL. " + "Ignoring acl=on option\n"); +#endif + } + kfree(s); + break; + default: continue; } @@ -294,6 +310,10 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, */ v9ses->flags &= ~V9FS_ACCESS_MASK; v9ses->flags |= V9FS_ACCESS_USER; + /* + * We support ACLs only in dotl and V9FS_ACCESS_CLIENT + */ + v9ses->flags &= ~V9FS_ACL_MASK; } /*FIXME !! */ /* for legacy mode, fall back to V9FS_ACCESS_ANY */ diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index c4b5d88..f3bad79 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -28,8 +28,10 @@ * @V9FS_PROTO_2000L: whether or not to use 9P2000.l extensions * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) + * @V9FS_ACCESS_CLIENT: Just like user, but access check is performed on client. * @V9FS_ACCESS_ANY: use a single attach for all users * @V9FS_ACCESS_MASK: bit mask of different ACCESS options + * @V9FS_ACL_ON: If ACLs are enforced * * Session flags reflect options selected by users at mount time */ @@ -37,13 +39,15 @@ V9FS_ACCESS_USER | \ V9FS_ACCESS_CLIENT) #define V9FS_ACCESS_MASK V9FS_ACCESS_ANY +#define V9FS_ACL_MASK V9FS_ACL_ON enum p9_session_flags { V9FS_PROTO_2000U = 0x01, V9FS_PROTO_2000L = 0x02, V9FS_ACCESS_SINGLE = 0x04, V9FS_ACCESS_USER = 0x08, - V9FS_ACCESS_CLIENT = 0x10 + V9FS_ACCESS_CLIENT = 0x10, + V9FS_ACL_ON = 0x20 }; /* possible values of ->cache */ diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index dbaabe3..357d3b4 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -91,7 +91,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, MS_NOATIME; #ifdef CONFIG_9P_FS_POSIX_ACL - if ((v9ses->flags & V9FS_ACCESS_MASK) == V9FS_ACCESS_CLIENT) + if ((v9ses->flags & V9FS_ACL_MASK) == V9FS_ACL_ON) sb->s_flags |= MS_POSIXACL; #endif