Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFS: Initialise verifiers for visible dentries in _nfs4_open_and_get_state

Ensure that the verifiers are initialised before calling
d_splice_alias() in _nfs4_open_and_get_state().

Reported-by: Michael Stoler <michael.stoler@vastdata.com>
Fixes: cf5b4059ba71 ("NFSv4: Fix races between open and dentry revalidation")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

+14 -13
+14 -13
fs/nfs/nfs4proc.c
··· 3174 3174 if (opendata->o_res.rflags & NFS4_OPEN_RESULT_PRESERVE_UNLINKED) 3175 3175 set_bit(NFS_INO_PRESERVE_UNLINKED, &NFS_I(state->inode)->flags); 3176 3176 3177 - dentry = opendata->dentry; 3178 - if (d_really_is_negative(dentry)) { 3179 - struct dentry *alias; 3180 - d_drop(dentry); 3181 - alias = d_splice_alias(igrab(state->inode), dentry); 3182 - /* d_splice_alias() can't fail here - it's a non-directory */ 3183 - if (alias) { 3184 - dput(ctx->dentry); 3185 - ctx->dentry = dentry = alias; 3186 - } 3187 - } 3188 - 3189 3177 switch(opendata->o_arg.claim) { 3190 3178 default: 3191 3179 break; ··· 3184 3196 break; 3185 3197 if (opendata->o_res.delegation.type != 0) 3186 3198 dir_verifier = nfs_save_change_attribute(dir); 3187 - nfs_set_verifier(dentry, dir_verifier); 3199 + } 3200 + 3201 + dentry = opendata->dentry; 3202 + nfs_set_verifier(dentry, dir_verifier); 3203 + if (d_really_is_negative(dentry)) { 3204 + struct dentry *alias; 3205 + d_drop(dentry); 3206 + alias = d_splice_alias(igrab(state->inode), dentry); 3207 + /* d_splice_alias() can't fail here - it's a non-directory */ 3208 + if (alias) { 3209 + dput(ctx->dentry); 3210 + nfs_set_verifier(alias, dir_verifier); 3211 + ctx->dentry = dentry = alias; 3212 + } 3188 3213 } 3189 3214 3190 3215 /* Parse layoutget results before we check for access */