]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work"
authorYang Erkun <yangerkun@huawei.com>
Mon, 16 Dec 2024 14:21:52 +0000 (22:21 +0800)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 17 Dec 2024 14:45:23 +0000 (09:45 -0500)
commit69d803c40edeaf94089fbc8751c9b746cdc35044
tree231458cb1faaf47056282c61a9ceceb23e3cdbe8
parent583772eec7b0096516a8ee8b1cc31401894f1e3a
nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work"

This reverts commit f8c989a0c89a75d30f899a7cabdc14d72522bb8d.

Before this commit, svc_export_put or expkey_put will call path_put with
sync mode. After this commit, path_put will be called with async mode.
And this can lead the unexpected results show as follow.

mkfs.xfs -f /dev/sda
echo "/ *(rw,no_root_squash,fsid=0)" > /etc/exports
echo "/mnt *(rw,no_root_squash,fsid=1)" >> /etc/exports
exportfs -ra
service nfs-server start
mount -t nfs -o vers=4.0 127.0.0.1:/mnt /mnt1
mount /dev/sda /mnt/sda
touch /mnt1/sda/file
exportfs -r
umount /mnt/sda # failed unexcepted

The touch will finally call nfsd_cross_mnt, add refcount to mount, and
then add cache_head. Before this commit, exportfs -r will call
cache_flush to cleanup all cache_head, and path_put in
svc_export_put/expkey_put will be finished with sync mode. So, the
latter umount will always success. However, after this commit, path_put
will be called with async mode, the latter umount may failed, and if
we add some delay, umount will success too. Personally I think this bug
and should be fixed. We first revert before bugfix patch, and then fix
the original bug with a different way.

Fixes: f8c989a0c89a ("nfsd: release svc_expkey/svc_export with rcu_work")
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/export.c
fs/nfsd/export.h