ACK / APPLIED[E/Unstable]: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: fix buggy unlink logic

Seth Forshee seth.forshee at
Fri Aug 30 17:04:35 UTC 2019

On Thu, Aug 29, 2019 at 08:45:07PM +0200, Christian Brauner wrote:
> BugLink:
> The way we messed with setting i_nlink was brittle and wrong. We used to
> set the i_nlink of the shiftfs dentry to be deleted to the i_nlink count
> of the underlay dentry of the directory it resided in which makes no
> sense whatsoever. We also missed drop_nlink() which is crucial since
> i_nlink affects whether a dentry is cleaned up on dput().
> With this I cannot reproduce the bug anymore where shiftfs misleads zfs
> into believing that a deleted file can not be removed from disk because
> it is still referenced.

Obviously the intent was not to copy i_nlink from the corresponding
inode in the lower filesystem, not the directory inode. Seems likely
that some confusing/inconsistent variable naming contributed to the

As I mentioned on irc, I'm conflicted on whether we should just
decrement the reference count like this or copy from the lower fs inode.
It should only matter if the lower fs is being modified underneath
shiftfs, and shiftfs cannot promise correct behavior if that happens, so
this should be ok.

Acked-by: Seth Forshee <seth.forshee at>

Please remember to submit these for the development release as well.
Applied to eoan/master-next and unstable/master, thanks!

More information about the kernel-team mailing list