kern/128427: mount_mfs warns "chmod: /usr/ports: Read-only file system"

Yoshihiro Ota ota at j.email.ne.jp
Tue Oct 28 03:10:03 UTC 2008


>Number:         128427
>Category:       kern
>Synopsis:       mount_mfs warns "chmod: /usr/ports: Read-only file system"
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 28 03:10:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Yoshihiro Ota
>Release:        7.1-PRERELEASE
>Organization:
>Environment:
... 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #441: Sat Oct 25 02:48:52 EDT 2008     root at xxx:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
mdmfs attempts to change permission on read-only file system and gets warning.
>How-To-Repeat:
# grep mfs /etc/fstab 
/dev/md.uzip /usr/ports mfs noauto,ro,-P,-F/usr/uzip/ports-20081003.uzip
# mount /usr/ports/
mount_mfs: chmod: /usr/ports: Read-only file system
# df /usr/ports/
Filesystem    1K-blocks   Used  Avail Capacity  Mounted on
/dev/md1.uzip    911262 462926 375436    55%    /usr/ports

>Fix:
Do not attempt chmod on read-only filesystem.

Patch attached with submission follows:

Index: sbin/mdmfs/mdmfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mdmfs/mdmfs.c,v
retrieving revision 1.33
diff -u -r1.33 mdmfs.c
--- sbin/mdmfs/mdmfs.c	14 May 2007 19:23:13 -0000	1.33
+++ sbin/mdmfs/mdmfs.c	28 Oct 2008 03:05:30 -0000
@@ -60,6 +60,7 @@
 	bool		 mi_have_gid;
 	mode_t		 mi_mode;
 	bool		 mi_have_mode;
+	bool		 mi_is_readonly;
 };
 
 static	bool debug;		/* Emit debugging information? */
@@ -195,6 +196,8 @@
 			break;
 		case 'o':
 			argappend(&mount_arg, "-o %s", optarg);
+			if(strcmp(optarg, "ro") == 0)
+				mi.mi_is_readonly = true;
 			break;
 		case 'P':
 			newfs = false;
@@ -440,7 +443,8 @@
 static void
 do_mtptsetup(const char *mtpoint, struct mtpt_info *mip)
 {
-
+	if (mip->mi_is_readonly)
+		return;
 	if (mip->mi_have_mode) {
 		debugprintf("changing mode of %s to %o.", mtpoint,
 		    mip->mi_mode);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list