* [PATCH] btrfs: Handle SGID bit when creating inodes
@ 2009-02-01 3:48 Chris Ball
2009-02-01 13:38 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Chris Ball @ 2009-02-01 3:48 UTC (permalink / raw)
To: linux-btrfs
Before this patch, new files/dirs would ignore the SGID bit on their
parent directory and always be owned by the creating user's uid/gid.
Signed-off-by: Chris Ball <cjb@laptop.org>
---
fs/btrfs/inode.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ebd7d6c..ce25bb3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3470,7 +3470,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
root->highest_inode = objectid;
inode->i_uid = current_fsuid();
- inode->i_gid = current_fsgid();
+
+ if (dir->i_mode & S_ISGID) {
+ inode->i_gid = dir->i_gid;
+ if (S_ISDIR(mode))
+ mode |= S_ISGID;
+ } else
+ inode->i_gid = current_fsgid();
+
inode->i_mode = mode;
inode->i_ino = objectid;
inode_set_bytes(inode, 0);
--
1.6.1.2
--
Chris Ball <cjb@laptop.org>
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-01 13:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-01 3:48 [PATCH] btrfs: Handle SGID bit when creating inodes Chris Ball
2009-02-01 13:38 ` Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox