From owner-svn-src-stable@FreeBSD.ORG Tue Sep 20 08:34:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88736106564A; Tue, 20 Sep 2011 08:34:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD928FC1B; Tue, 20 Sep 2011 08:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K8YFFB018222; Tue, 20 Sep 2011 08:34:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K8YFaL018220; Tue, 20 Sep 2011 08:34:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109200834.p8K8YFaL018220@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 20 Sep 2011 08:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225692 - stable/8/sbin/mdmfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 08:34:15 -0000 Author: kib Date: Tue Sep 20 08:34:15 2011 New Revision: 225692 URL: http://svn.freebsd.org/changeset/base/225692 Log: MFC r225534: Do not try to change the mode or ownership of the root of the mountpoint when newly established mdmfs mount is readonly. Modified: stable/8/sbin/mdmfs/mdmfs.c Directory Properties: stable/8/sbin/mdmfs/ (props changed) Modified: stable/8/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/8/sbin/mdmfs/mdmfs.c Tue Sep 20 08:11:07 2011 (r225691) +++ stable/8/sbin/mdmfs/mdmfs.c Tue Sep 20 08:34:15 2011 (r225692) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -60,6 +61,7 @@ struct mtpt_info { bool mi_have_gid; mode_t mi_mode; bool mi_have_mode; + bool mi_forced_pw; }; static bool debug; /* Emit debugging information? */ @@ -204,6 +206,7 @@ main(int argc, char **argv) usage(); mi.mi_mode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO); mi.mi_have_mode = true; + mi.mi_forced_pw = true; free(set); break; case 'S': @@ -223,6 +226,7 @@ main(int argc, char **argv) break; case 'w': extract_ugid(optarg, &mi); + mi.mi_forced_pw = true; break; case 'X': debug = true; @@ -443,6 +447,29 @@ do_mount(const char *args, const char *m static void do_mtptsetup(const char *mtpoint, struct mtpt_info *mip) { + struct statfs sfs; + + if (!mip->mi_have_mode && !mip->mi_have_uid && !mip->mi_have_gid) + return; + + if (!norun) { + if (statfs(mtpoint, &sfs) == -1) { + warn("statfs: %s", mtpoint); + return; + } + if ((sfs.f_flags & MNT_RDONLY) != 0) { + if (mip->mi_forced_pw) { + warnx( + "Not changing mode/owner of %s since it is read-only", + mtpoint); + } else { + debugprintf( + "Not changing mode/owner of %s since it is read-only", + mtpoint); + } + return; + } + } if (mip->mi_have_mode) { debugprintf("changing mode of %s to %o.", mtpoint,