util-linux: upstream fix for broken mount

This commit is contained in:
Juergen Daubert 2012-08-28 15:07:15 +02:00
parent 4c55db5c74
commit 0a11061881
3 changed files with 81 additions and 2 deletions

View File

@ -1 +1,2 @@
9377943f01f9bdb7ae39eb7ef2a23c7f util-linux-2.22-rc2-fix1.diff
505d71aaade14033d060373d87e4f41d util-linux-2.22-rc2.tar.xz

View File

@ -5,12 +5,15 @@
name=util-linux
version=2.22-rc2
release=1
source=(http://ftp.kernel.org/pub/linux/utils/$name/v2.22/$name-$version.tar.xz)
release=2
source=(http://ftp.kernel.org/pub/linux/utils/$name/v2.22/$name-$version.tar.xz \
$name-$version-fix1.diff)
build() {
cd $name-$version
patch -p1 -i $SRC/$name-$version-fix1.diff
./configure --prefix=/usr \
--mandir=/usr/man \
--disable-{nls,wall} \

View File

@ -0,0 +1,75 @@
commit c3085df65fe18c9f6077e1903a6ead19a4318d6d
Author: Karel Zak <kzak@redhat.com>
Date: Mon Aug 27 19:26:07 2012 +0200
libmount: remount does not add entry to mtab file
# mount -n -o ro /dev/sda1 /
# mount -o remount,rw /dev/sda1 /
For the backward compatibility the command mount(8) should to add a
new entry to the file /etc/mtab on remount if the original entry not
found (because previous mount has been called with -n).
Reported-by: <frinnst> on IRC
Signed-off-by: Karel Zak <kzak@redhat.com>
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index caabd05..4f04c8e 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -562,6 +562,17 @@ leave:
return rc;
}
+static int add_file_entry(struct libmnt_table *tb, struct libmnt_update *upd)
+{
+ struct libmnt_fs *fs = mnt_copy_fs(NULL, upd->fs);
+
+ if (!fs)
+ return -ENOMEM;
+
+ mnt_table_add_fs(tb, fs);
+ return update_table(upd, tb);
+}
+
static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
{
struct libmnt_table *tb;
@@ -579,16 +590,8 @@ static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
- if (tb) {
- struct libmnt_fs *fs = mnt_copy_fs(NULL, upd->fs);
- if (!fs)
- rc = -ENOMEM;
- else {
- mnt_table_add_fs(tb, fs);
- rc = update_table(upd, tb);
- }
- }
-
+ if (tb)
+ rc = add_file_entry(tb, upd);
if (lc)
mnt_unlock_file(lc);
@@ -621,7 +624,6 @@ static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc
mnt_free_fs(rem);
}
}
-
if (lc)
mnt_unlock_file(lc);
@@ -691,7 +693,8 @@ static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock *
rc = mnt_fs_set_options(cur, mnt_fs_get_options(fs));
if (!rc)
rc = update_table(upd, tb);
- }
+ } else
+ rc = add_file_entry(tb, upd); /* not found, add new */
}
if (lc)