diff --git a/util-linux-2.14.1-mount_race.patch b/util-linux-2.14.1-mount_race.patch index 23a232f..9769d1d 100644 --- a/util-linux-2.14.1-mount_race.patch +++ b/util-linux-2.14.1-mount_race.patch @@ -1,7 +1,7 @@ Index: util-linux-ng-2.14.1/mount/fstab.c =================================================================== ---- util-linux-ng-2.14.1.orig/mount/fstab.c 2008-05-29 01:01:02.000000000 +0200 -+++ util-linux-ng-2.14.1/mount/fstab.c 2008-11-18 18:08:59.000000000 +0100 +--- util-linux-ng-2.14.1.orig/mount/fstab.c 2008-11-24 14:26:14.000000000 +0100 ++++ util-linux-ng-2.14.1/mount/fstab.c 2008-11-24 14:45:35.000000000 +0100 @@ -773,8 +773,6 @@ update_mtab (const char *dir, struct my_ if (mtab_does_not_exist() || !mtab_is_writable()) return; @@ -22,8 +22,8 @@ Index: util-linux-ng-2.14.1/mount/fstab.c Index: util-linux-ng-2.14.1/mount/umount.c =================================================================== ---- util-linux-ng-2.14.1.orig/mount/umount.c 2008-07-02 15:08:50.000000000 +0200 -+++ util-linux-ng-2.14.1/mount/umount.c 2008-11-19 17:17:36.000000000 +0100 +--- util-linux-ng-2.14.1.orig/mount/umount.c 2008-11-24 14:26:14.000000000 +0100 ++++ util-linux-ng-2.14.1/mount/umount.c 2008-11-24 14:46:50.000000000 +0100 @@ -102,6 +102,8 @@ check_special_umountprog(const char *spe if (strlen(type) < 100) { sprintf(umountprog, "/sbin/umount.%s", type); @@ -33,15 +33,16 @@ Index: util-linux-ng-2.14.1/mount/umount.c res = fork(); if (res == 0) { char *umountargs[8]; -@@ -383,6 +385,7 @@ umount_all (char *types, char *test_opts +@@ -383,6 +385,8 @@ umount_all (char *types, char *test_opts struct mntentchn *mc, *hd; int errors = 0; -+ lock_mtab(); ++ if (!nomtab && mtab_is_writable()) ++ lock_mtab(); hd = mtab_head(); if (!hd->prev) die (2, _("umount: cannot find list of filesystems to unmount")); -@@ -393,6 +396,7 @@ umount_all (char *types, char *test_opts +@@ -393,6 +397,7 @@ umount_all (char *types, char *test_opts mc->m.mnt_type, mc->m.mnt_opts, mc); } } @@ -49,7 +50,7 @@ Index: util-linux-ng-2.14.1/mount/umount.c sync (); return errors; -@@ -463,6 +467,7 @@ umount_file (char *arg) { +@@ -463,6 +468,7 @@ umount_file (char *arg) { const char *file, *options; int fstab_has_user, fstab_has_users, fstab_has_owner, fstab_has_group; int ok; @@ -57,15 +58,16 @@ Index: util-linux-ng-2.14.1/mount/umount.c if (!*arg) { /* "" would be expanded to `pwd` */ die(2, _("Cannot umount \"\"\n")); -@@ -473,6 +478,7 @@ umount_file (char *arg) { +@@ -473,6 +479,8 @@ umount_file (char *arg) { if (verbose > 1) printf(_("Trying to umount %s\n"), file); -+ lock_mtab(); ++ if (!nomtab && mtab_is_writable()) ++ lock_mtab(); mc = getmntdirbackward(file, NULL); if (!mc) mc = getmntdevbackward(file, NULL); -@@ -572,9 +578,12 @@ umount_file (char *arg) { +@@ -572,9 +580,12 @@ umount_file (char *arg) { } if (mc) @@ -82,8 +84,8 @@ Index: util-linux-ng-2.14.1/mount/umount.c int Index: util-linux-ng-2.14.1/mount/mount.c =================================================================== ---- util-linux-ng-2.14.1.orig/mount/mount.c 2008-11-18 18:08:59.000000000 +0100 -+++ util-linux-ng-2.14.1/mount/mount.c 2008-11-18 18:09:04.000000000 +0100 +--- util-linux-ng-2.14.1.orig/mount/mount.c 2008-11-24 14:26:14.000000000 +0100 ++++ util-linux-ng-2.14.1/mount/mount.c 2008-11-24 14:46:13.000000000 +0100 @@ -521,8 +521,6 @@ create_mtab (void) { int flags; mntFILE *mfp; @@ -118,11 +120,12 @@ Index: util-linux-ng-2.14.1/mount/mount.c } } my_free(mnt.mnt_fsname); -@@ -1138,12 +1132,14 @@ try_mount_one (const char *spec0, const +@@ -1138,12 +1132,15 @@ try_mount_one (const char *spec0, const mount_retry: block_signals (SIG_BLOCK); -+ lock_mtab(); ++ if (!nomtab && mtab_is_writable()) ++ lock_mtab(); if (!fake) { mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS, @@ -133,7 +136,7 @@ Index: util-linux-ng-2.14.1/mount/mount.c block_signals (SIG_UNBLOCK); res = status; goto out; -@@ -1163,6 +1159,7 @@ mount_retry: +@@ -1163,6 +1160,7 @@ mount_retry: pass); } @@ -141,7 +144,7 @@ Index: util-linux-ng-2.14.1/mount/mount.c block_signals (SIG_UNBLOCK); res = 0; goto out; -@@ -1173,6 +1170,7 @@ mount_retry: +@@ -1173,6 +1171,7 @@ mount_retry: if (loop) del_loop(spec); diff --git a/util-linux.changes b/util-linux.changes index 42c9a3a..3f39d58 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Nov 24 15:24:11 CET 2008 - mkoenig@suse.de + +- mount: fix locking patch to not break -n [bnc#447937] + ------------------------------------------------------------------- Thu Nov 20 18:08:33 CET 2008 - mkoenig@suse.de diff --git a/util-linux.spec b/util-linux.spec index 54f6a7e..1c1f606 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -30,7 +30,7 @@ License: BSD 3-Clause; GPL v2 or later Group: System/Base AutoReqProv: on Version: 2.14.1 -Release: 7 +Release: 8 Requires: %name-lang = %{version} Summary: A collection of basic system utilities Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%version.tar.bz2 @@ -609,6 +609,8 @@ fi #%endif %changelog +* Mon Nov 24 2008 mkoenig@suse.de +- mount: fix locking patch to not break -n [bnc#447937] * Thu Nov 20 2008 mkoenig@suse.de - mount: enhance mount/umount mtab locking and lock the whole read mtab/syscall/write mtab process to avoid mtab corruption