|
Description
|
zfs_dirempty() can return EEXIST even if its empty if there are other threads (say
a lookup) active on that directory. This is due to dzp->z_dirlocks != 0.
Some possible solutions:
1) add a new "remove" reader/writer lock that blocks out new zfs_dirent_lock() requests
when grabbed as WRITER.
2) Simply delay and retry if the directory is really empty (dzp->z_phys->zp_size == 2), but
there are lookers (dzp->z_dirlocks != 0)
3) Set some flag in the dzp saying its removed, deny future creates, and immediatley
return success to user. Real cleanup is delayed until final looker finishes.
1) currently seems like the best approach. 2) can conceivable loop forever. 3) this one
might add some code/interface ugliness.
|