From 7c7298cffc8f4417c95117c2a432f962c066499d Mon Sep 17 00:00:00 2001 From: Harsh Prateek Bora Date: Wed, 18 Aug 2010 06:01:52 +0000 Subject: [PATCH] fs/9p: mkdir fix for setting S_ISGID bit as per parent directory The current implementation of 9p client mkdir function does not set the S_ISGID mode bit for the directory being created if the parent directory has this bit set. This patch fixes this problem so that the newly created directory inherits the gid from parent directory and not from the process creating this directory, when the S_ISGID bit is set in parent directory. Signed-off-by: Harsh Prateek Bora Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 88efc161743b..c3d200d41dca 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -876,6 +876,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, struct dentry *dentry, v9ses = v9fs_inode2v9ses(dir); mode |= S_IFDIR; + if (dir->i_mode & S_ISGID) + mode |= S_ISGID; dir_dentry = v9fs_dentry_from_dir_inode(dir); dfid = v9fs_fid_lookup(dir_dentry); if (IS_ERR(dfid)) { -- 2.20.1