All of lore.kernel.org
 help / color / mirror / Atom feed
* NFS, two d_delete() calls in nfs_unlink()
@ 2022-08-17  9:29 J. R. Okajima
  2022-08-18  2:55 ` NeilBrown
  0 siblings, 1 reply; 6+ messages in thread
From: J. R. Okajima @ 2022-08-17  9:29 UTC (permalink / raw)
  To: neilb, trond.myklebust; +Cc: linux-nfs

Hello NeilBrown and Trond Myklebust,

By the commin in v6.0-rc1,
	3c59366c207e 2022-08-08 NFS: don't unhash dentry during unlink/rename
nfs_unlink() stopped calling __d_drop().
And it MAY cause two d_delete() calls. If it happens, the second call
leads to NULL pointer access because d_inode is already cleared.

Here is the detail.

nfs_unlink()
+ nfs_safe_remove()
  + NFS_PROTO(dir)->remove() <-- returns ENOENT
  + nfs_dentry_handle_enoent()
    + if (simple_positive()) d_delete() <-- 1st call and d_inode is cleared
+ nfs_dentry_remove_handle_error()
  + if (ENOENT) d_delete() <-- second call and NULL d_inode is accessed

How about adding a condition for d_delete() call in
nfs_dentry_remove_handle_error(), such like simple_positive()?


J. R. Okajima

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-18 23:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-17  9:29 NFS, two d_delete() calls in nfs_unlink() J. R. Okajima
2022-08-18  2:55 ` NeilBrown
2022-08-18  3:31   ` hooanon05g
2022-08-18 18:38     ` Olga Kornievskaia
2022-08-18 23:05     ` NeilBrown
2022-08-18 23:23       ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.