Skip to contentSkip to conversation

autofs4_d_automount() can change path->dentry param

DISCUSSION David Howells 2 participants 2 messages Jan 15, 2011 – Jan 17, 2011 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi Ian,

I've just noticed that autofs4_d_automount() can change the dentry pointer in the path parameter (via autofs4_mountpoint_changed()). Is this just doing a straight substitution of one dentry for its equivalent? I don't think it'll be a problem for follow_automount() and follow_managed(), provided the dentry stays in the same namespace - but if we eliminate the vfsmount pointer and just pass the dentry pointer in to d_automount(), you won't be able to do this anymore. Would it work to simply return NULL here and hope the recheck picks up the substitution?

David

maintainer
#1 lore raw
Quoted 10 lines · David Howells

Hi Ian,

I've just noticed that autofs4_d_automount() can change the dentry pointer in the path parameter (via autofs4_mountpoint_changed()). Is this just doing a straight substitution of one dentry for its equivalent? I don't think it'll be a problem for follow_automount() and follow_managed(), provided the dentry stays in the same namespace - but if we eliminate the vfsmount pointer and just pass the dentry pointer in to d_automount(), you won't be able to do this anymore. Would it work to simply return NULL here and hope the recheck picks up the substitution?

I don't think so.

It happens if the mount point dentry is removed and recreated during a callback to the daemon so a d_lookup() then returns the replacement dentry. If the vfsmount isn't available we would need to be able to return the new dentry in much the same as ->lookup() will use a replacement dentry if it is returned. I guess that's still a problem if we need to return a vfsmount or ERR_PTR or NULL.

Ian