Bug 152079 - [msdosfs] [patch] Small cleanups from the other NetBSD/OpenBSD
Summary: [msdosfs] [patch] Small cleanups from the other NetBSD/OpenBSD
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 15:50 UTC by Pedro F. Giffuni
Modified: 2011-04-03 09:38 UTC (History)
0 users

See Also:


Attachments
file.diff (1.53 KB, patch)
2010-11-09 15:50 UTC, Pedro F. Giffuni
no flags Details | Diff
patch-msdosfs.txt (2.28 KB, patch)
2011-03-25 16:09 UTC, Pedro F. Giffuni
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro F. Giffuni 2010-11-09 15:50:06 UTC
Here are some small cleanups to sync with the other BSDs.

denode.h
NetBSD: protect userland exported files against multiple inclusion.
OpenBSD: Move some macros in <msdosfs/denode.h> to outside the #ifdef _KERNEL
so that libkvm doesn't need to define that, thereby avoiding some warnings.


msdosfs_lookup.c
NetBSD: Return EINVAL for rename and delete operations to the
root directory instead of the erroneous EROFS.

Fix: Patch follows.

Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-11-12 09:32:29 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Pedro F. Giffuni 2011-03-25 16:09:04 UTC
Include a small fix from NetBSD:

msdosfs_vnops.c Revision 1.73:
Remove a vnode reference leak from msdosfs_rename. Release tdvp if either
doscheckpath() or relookup() fails.

Adjust test fs/vfs/t_vnops.c and remove the link count test for msdos.

Fixes NetBSD PR #44661



      
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-03-25 22:31:42 UTC
Author: kib
Date: Fri Mar 25 22:31:28 2011
New Revision: 220014
URL: http://svn.freebsd.org/changeset/base/220014

Log:
  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

Modified:
  head/sys/fs/msdosfs/msdosfs_lookup.c

Modified: head/sys/fs/msdosfs/msdosfs_lookup.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_lookup.c	Fri Mar 25 22:17:24 2011	(r220013)
+++ head/sys/fs/msdosfs/msdosfs_lookup.c	Fri Mar 25 22:31:28 2011	(r220014)
@@ -458,7 +458,7 @@ foundroot:
 		 * 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 @@ foundroot:
 	 */
 	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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 Pedro F. Giffuni 2011-03-26 16:54:03 UTC
Please close this PR.

Apparently the last submission would introduce a panic in FreeBSD.
Comment 5 Jaakko Heinonen freebsd_committer freebsd_triage 2011-04-03 09:38:51 UTC
State Changed
From-To: open->closed

Closed at submitter's request.