ZFS/GFS locking fixes

Richard Kojedzinszky krichy at cflinux.hu
Sun Dec 29 22:46:09 UTC 2013


Dear devs,

Maybe PJD has forwarded my conversation with him, I've made to fixes for 
my zfs/gfs locking issues. They can be found here: 
https://github.com/rkojedzinszky/freebsd/commits/releng/9.2-zfs

While this solves most of my discovered issues, one still remained. Commit 
https://github.com/rkojedzinszky/freebsd/commit/1d8972b3f353f986eb5b85bc108b1c0d946d3218 
introduced another deadlock possibility:
When 'zfs send -R' tries to exit, it calls zfsdev_close(), which acquires 
spa_namespace_lock, which then invokes zfs_unmount_snap(), which goes to
zfsctl_snapshot_inactive() which will lock the .zfs/snapshot's 
sdp->sd_lock. The same time, when zfsctl_snapdir_lookup() is running, 
holding the same directory's sdp->sd_lock, tries to mount a snapshot, 
which somewhere tries to acquire spa_namespace_lock, and they got into a 
deadlock.

This problem also can be used to DoS a system, as an administrator may 
have set up to backup its system using zfs send, and a normal user can 
initiate the other process (the mount).

What could be the solution?

Thanks in advance,
Kojedzinszky Richard


More information about the zfs-devel mailing list