3
0
forked from pool/util-linux

Accepting request 21341 from Base:System

Copy from Base:System/util-linux based on submit request 21341 from user hennevogel

OBS-URL: https://build.opensuse.org/request/show/21341
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=78
This commit is contained in:
OBS User autobuild 2009-10-02 21:21:11 +00:00 committed by Git OBS Bridge
parent 1cf56bb702
commit a94b7af776
4 changed files with 23 additions and 185 deletions

View File

@ -1,163 +0,0 @@
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 2009-01-07 12:18:03.000000000 +0100
@@ -773,8 +773,6 @@ update_mtab (const char *dir, struct my_
if (mtab_does_not_exist() || !mtab_is_writable())
return;
- lock_mtab();
-
/* having locked mtab, read it again */
mc0 = mc = &mtabhead;
mc->nxt = mc->prev = NULL;
@@ -893,7 +891,7 @@ update_mtab (const char *dir, struct my_
}
leave:
- unlock_mtab();
+ ;
}
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 2009-01-07 12:50:48.000000000 +0100
@@ -102,6 +102,8 @@ check_special_umountprog(const char *spe
if (strlen(type) < 100) {
sprintf(umountprog, "/sbin/umount.%s", type);
if (stat(umountprog, &statbuf) == 0) {
+ /* unlock mtab if we need to exec */
+ unlock_mtab();
res = fork();
if (res == 0) {
char *umountargs[8];
@@ -383,6 +385,8 @@ umount_all (char *types, char *test_opts
struct mntentchn *mc, *hd;
int errors = 0;
+ 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 +397,7 @@ umount_all (char *types, char *test_opts
mc->m.mnt_type, mc->m.mnt_opts, mc);
}
}
+ unlock_mtab();
sync ();
return errors;
@@ -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;
+ int ret;
if (!*arg) { /* "" would be expanded to `pwd` */
die(2, _("Cannot umount \"\"\n"));
@@ -473,6 +479,8 @@ umount_file (char *arg) {
if (verbose > 1)
printf(_("Trying to umount %s\n"), file);
+ if (!nomtab && mtab_is_writable())
+ lock_mtab();
mc = getmntdirbackward(file, NULL);
if (!mc)
mc = getmntdevbackward(file, NULL);
@@ -572,9 +580,12 @@ umount_file (char *arg) {
}
if (mc)
- return umount_one_bw (file, mc);
+ ret = umount_one_bw (file, mc);
else
- return umount_one (arg, arg, arg, arg, NULL);
+ ret = umount_one (arg, arg, arg, arg, NULL);
+
+ unlock_mtab();
+ return ret;
}
int
Index: util-linux-ng-2.14.1/mount/mount.c
===================================================================
--- util-linux-ng-2.14.1.orig/mount/mount.c 2009-01-07 12:18:03.000000000 +0100
+++ util-linux-ng-2.14.1/mount/mount.c 2009-01-07 14:40:16.000000000 +0100
@@ -521,8 +521,6 @@ create_mtab (void) {
int flags;
mntFILE *mfp;
- lock_mtab();
-
mfp = my_setmntent (_PATH_MOUNTED, "a+");
if (mfp == NULL || mfp->mntent_fp == NULL) {
int errsv = errno;
@@ -556,8 +554,6 @@ create_mtab (void) {
}
my_endmntent (mfp);
- unlock_mtab();
-
reset_mtab_info();
}
@@ -626,6 +622,8 @@ check_special_mountprog(const char *spec
if (strlen(type) < 100) {
sprintf(mountprog, "/sbin/mount.%s", type);
if (stat(mountprog, &statbuf) == 0) {
+ /* unlock mtab if we need to exec */
+ unlock_mtab();
if (verbose)
fflush(stdout);
res = fork();
@@ -1004,7 +1002,6 @@ update_mtab_entry(const char *spec, cons
else {
mntFILE *mfp;
- lock_mtab();
mfp = my_setmntent(_PATH_MOUNTED, "a+");
if (mfp == NULL || mfp->mntent_fp == NULL) {
int errsv = errno;
@@ -1018,7 +1015,6 @@ update_mtab_entry(const char *spec, cons
}
}
my_endmntent(mfp);
- unlock_mtab();
}
}
my_free(mnt.mnt_fsname);
@@ -1138,12 +1134,15 @@ try_mount_one (const char *spec0, const
mount_retry:
block_signals (SIG_BLOCK);
+ if (!nomtab && mtab_is_writable())
+ lock_mtab();
if (!fake) {
mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
mount_opts, &special, &status);
if (special) {
+ unlock_mtab();
block_signals (SIG_UNBLOCK);
res = status;
goto out;
@@ -1163,6 +1162,7 @@ mount_retry:
pass);
}
+ unlock_mtab();
block_signals (SIG_UNBLOCK);
res = 0;
goto out;
@@ -1173,6 +1173,7 @@ mount_retry:
if (loop)
del_loop(spec);
+ unlock_mtab();
block_signals (SIG_UNBLOCK);
/* Mount failed, complain, but don't die. */

View File

@ -1,27 +1,23 @@
Index: util-linux-ng-2.14.1/mount/umount.c diff -Nurw util-linux-ng-2.16.orig/mount/umount.c util-linux-ng-2.16/mount/umount.c
=================================================================== --- util-linux-ng-2.16.orig/mount/umount.c 2009-07-04 01:20:06.000000000 +0200
--- util-linux-ng-2.14.1.orig/mount/umount.c 2008-11-20 15:01:09.000000000 +0100 +++ util-linux-ng-2.16/mount/umount.c 2009-09-29 14:50:44.000000000 +0200
+++ util-linux-ng-2.14.1/mount/umount.c 2008-11-20 15:04:39.000000000 +0100 @@ -361,6 +361,7 @@
@@ -384,6 +384,7 @@ static int
umount_all (char *types, char *test_opts) { umount_all (char *types, char *test_opts) {
struct mntentchn *mc, *hd; struct mntentchn *mc, *hd;
int errors = 0; int errors = 0;
+ int do_sync = 0; + int do_sync = 0;
lock_mtab();
hd = mtab_head(); hd = mtab_head();
@@ -394,11 +395,13 @@ umount_all (char *types, char *test_opts if (!hd->prev)
@@ -370,9 +371,11 @@
&& matching_opts (mc->m.mnt_opts, test_opts)) { && matching_opts (mc->m.mnt_opts, test_opts)) {
errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir, errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir,
mc->m.mnt_type, mc->m.mnt_opts, mc); mc->m.mnt_type, mc->m.mnt_opts, mc);
+ do_sync = 1; + do_sync = 1;
} }
} }
unlock_mtab();
- sync ();
+ if (do_sync) + if (do_sync)
+ sync (); sync ();
return errors; return errors;
} }

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Sep 29 12:58:37 UTC 2009 - hvogel@novell.com
- finaly remove the mount mtab locking patch:
* util-linux-2.14.1-mount_race.patch
It causes too much regressions.
-------------------------------------------------------------------
Mon Jul 13 14:21:07 CEST 2009 - kay.sievers@novell.com Mon Jul 13 14:21:07 CEST 2009 - kay.sievers@novell.com
- update to final 2.16 release - update to final 2.16 release

View File

@ -29,7 +29,7 @@ License: BSD 3-clause (or similar) ; GPL v2 or later
Group: System/Base Group: System/Base
AutoReqProv: on AutoReqProv: on
Version: 2.16 Version: 2.16
Release: 2 Release: 3
Requires: %name-lang = %{version} Requires: %name-lang = %{version}
Summary: A collection of basic system utilities Summary: A collection of basic system utilities
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%version.tar.bz2 Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%version.tar.bz2
@ -61,15 +61,13 @@ Source51: blkid.conf
## util-linux patches ## util-linux patches
## ##
# add hostid # add hostid
Patch2: util-linux-2.12-misc_utils_hostid.patch Patch0: util-linux-2.12-misc_utils_hostid.patch
# 241372 - remove legacy warnings from fdisk # 241372 - remove legacy warnings from fdisk
Patch3: util-linux-2.12r-fdisk_remove_bogus_warnings.patch Patch1: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
# bnc#444966
Patch17: util-linux-2.14.1-mount_race.patch
# bnc#447036 # bnc#447036
Patch18: util-linux-2.14.1-mount_skip_sync.patch Patch2: util-linux-2.14.1-mount_skip_sync.patch
# crypto patch # crypto patch
Patch30: util-linux-mount_losetup_crypto.patch Patch3: util-linux-mount_losetup_crypto.patch
## ##
## adjtimex ## adjtimex
## ##
@ -150,11 +148,10 @@ unique IDs (UUIDs).
%lang_package %lang_package
%prep %prep
%setup -q -a 9 -b 10 -b 11 -b 12 -b 13 -n %name-ng-%version %setup -q -a 9 -b 10 -b 11 -b 12 -b 13 -n %name-ng-%version
%patch0 -p1
%patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch17 -p1
%patch18 -p1
%patch30 -p1
# #
cd adjtimex-* cd adjtimex-*
%patch50 -p1 %patch50 -p1