Report EBUSY instead of EROFS for attempt of deleting or renaming the

root directory of msdosfs mount. The VFS code would handle deletion
case itself too, assuming VV_ROOT flag is not lost. The msdosfs_rename()
should also note attempt to rename root via doscheckpath() or different
mount point check leading to EXDEV. Nonetheless, keep the checks for now.

The change is inspired by NetBSD change referenced in PR, but return
EBUSY like kern_unlinkat() does.

PR:	kern/152079
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2011-03-25 22:31:28 +00:00
parent 2b3da0fd11
commit 9ba671debc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220014

View File

@ -458,7 +458,7 @@ msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
* Don't allow deleting the root.
*/
if (blkoff == MSDOSFSROOT_OFS)
return EROFS; /* really? XXX */
return (EBUSY);
/*
* Write access to directory required to delete files.
@ -491,7 +491,7 @@ msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
*/
if (nameiop == RENAME && (flags & ISLASTCN)) {
if (blkoff == MSDOSFSROOT_OFS)
return EROFS; /* really? XXX */
return (EBUSY);
error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread);
if (error)