cifs: set sb->s_d_op before calling d_make_root()
Subsystems (2)
PATCH 1/1 cifs: set sb->s_d_op before calling d_make_root()
Currently, the s_root dentry doesn't get its d_op pointer set to anything. This breaks lookups in the root of case-insensitive mounts since that relies on having d_hash and d_compare routines that know to treat the filename as case-insensitive.
cifs.ko has been broken this way for a long time, but commit 1c929cfe6 ("switch cifs"), added a cryptic comment which is removed in the patch below, which makes me wonder if this was done deliberately for some reason. It's not clear to me why we'd want the s_root not to have d_op set properly.
It may have something to do with d_automount or d_revalidate on the root, but my suspicion in looking over the code is that Al was just trying to preserve the existing behavior when changing this code over to use s_d_op.
This patch changes it so that we set s_d_op before calling d_make_root and removes the comment. I tested mounting, accessing and unmounting several types of shares (including DFS referrals) and everything still seemed to work OK afterward. I could be missing something however, so please do let me know if I am.
--- fs/cifs/cifsfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/cifs/cifsfs.c +5 -6
@@ -147,18 +147,17 @@ cifs_read_super(struct super_block *sb) goto out_no_root; } +if (cifs_sb_master_tcon (cifs_sb)->nocase) + sb->s_d_op = &cifs_ci_dentry_ops; +else + sb->s_d_op = &cifs_dentry_ops; + sb->s_root =d_make_root (inode);if (!sb->s_root) { rc = -ENOMEM ; goto out_no_root; } -/* do that *after* d_make_root() - we want NULL ->d_op for root here */ -if (cifs_sb_master_tcon (cifs_sb)->nocase) - sb->s_d_op = &cifs_ci_dentry_ops; -else - sb->s_d_op = &cifs_dentry_ops; -#ifdef CONFIG_CIFS_NFSD_EXPORT if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_SERVER_INUM ) {cifs_dbg (FYI ,"export ops supported\n" );
Signature · 1 line
1.8.3.1
A message that is not in the archive (sent off-list or not yet received): 1375198724-22857-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Added to for-next branch of cifs-2.6.git
Quoted 61 lines · Jeff Layton
Currently, the
s_rootdentry doesn't get itsd_oppointer set to anything. This breaks lookups in the root of case-insensitive mounts since that relies on havingd_hashandd_compareroutines that know to treat the filename as case-insensitive.cifs.ko has been broken this way for a long time, but commit
1c929cfe6("switch cifs"), added a cryptic comment which is removed in the patch below, which makes me wonder if this was done deliberately for some reason. It's not clear to me why we'd want thes_rootnot to haved_opset properly.It may have something to do with
d_automountord_revalidateon the root, but my suspicion in looking over the code is that Al was just trying to preserve the existing behavior when changing this code over to uses_d_op.This patch changes it so that we set
s_d_opbefore callingd_make_rootand removes the comment. I tested mounting, accessing and unmounting several types of shares (including DFS referrals) and everything still seemed to work OK afterward. I could be missing something however, so please do let me know if I am.Reported-by Jan-Marek Glogowski <[email protected]>Cc Al Viro <[email protected]>Cc Ian Kent <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/cifs/cifsfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)fs/cifs/cifsfs.c +5
-7@@ -147,18 +147,17 @@ cifs_read_super(struct super_block *sb) goto out_no_root; } +if (cifs_sb_master_tcon (cifs_sb)->nocase) + sb->s_d_op = &cifs_ci_dentry_ops; +else + sb->s_d_op = &cifs_dentry_ops; + sb->s_root =d_make_root (inode);if (!sb->s_root) { rc = -ENOMEM ; goto out_no_root; } -/* do that *after* d_make_root() - we want NULL ->d_op for root here */ -if (cifs_sb_master_tcon (cifs_sb)->nocase) - sb->s_d_op = &cifs_ci_dentry_ops; -else - sb->s_d_op = &cifs_dentry_ops; -#ifdef CONFIG_CIFS_NFSD_EXPORT if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_SERVER_INUM ) {cifs_dbg (FYI ,"export ops supported\n" ); --1.8.3.1
Signature · 3 lines
Thanks, Steve