]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: use lock from mnt_update_table()
authorKarel Zak <kzak@redhat.com>
Wed, 13 Apr 2011 08:49:26 +0000 (10:49 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Apr 2011 11:09:54 +0000 (13:09 +0200)
The mnt_update_table() is able to create a mtab lock now.

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/fstab.c
mount/fstab.h
mount/mount.c
mount/umount.c

index c04e9733e658ced4f5f71566a6d833c47557dd43..8ce733bf8ed9280cd655ded757296d73af534b4f 100644 (file)
@@ -578,21 +578,6 @@ setlkw_timeout (int sig) {
      /* nothing, fcntl will fail anyway */
 }
 
-#ifdef HAVE_LIBMOUNT_MOUNT
-static struct libmnt_lock *libmount_lock;
-
-struct libmnt_lock *
-init_libmount_lock(const char *filename)
-{
-       if (filename)
-               return libmount_lock = mnt_new_lock(filename, 0);
-       if (libmount_lock)
-               mnt_free_lock(libmount_lock);
-       libmount_lock = NULL;
-       return NULL;
-}
-#endif
-
 /* Remove lock file.  */
 void
 unlock_mtab (void) {
@@ -602,10 +587,6 @@ unlock_mtab (void) {
                unlink (_PATH_MOUNTED_LOCK);
                we_created_lockfile = 0;
        }
-#ifdef HAVE_LIBMOUNT_MOUNT
-       if (libmount_lock)
-               mnt_unlock_file(libmount_lock);
-#endif
 }
 
 /* Create the lock file.
index 15a7ecad6a2170b1d671285bf9271c7527caeb09..bbef33b51039ec55fcf0e25a6dab7d131cc8d42b 100644 (file)
@@ -6,7 +6,6 @@
 #ifdef HAVE_LIBMOUNT_MOUNT
 #define USE_UNSTABLE_LIBMOUNT_API
 #include <libmount.h>
-extern struct libmnt_lock *init_libmount_lock(const char *filename);
 #endif
 
 int mtab_is_writable(void);
index 8af218baf72636ce2699c0454fbafff97e1753b3..42500743507b1d2c4eff4cd4b64126504ff8db94 100644 (file)
@@ -1402,9 +1402,7 @@ static void update_mtab_entry(int flags)
                        create_mtab ();
                }
 
-               lc = init_libmount_lock( mnt_update_get_filename(mtab_update) );
-               mnt_update_table(mtab_update, lc);
-               init_libmount_lock(NULL);
+               mnt_update_table(mtab_update, NULL);
        }
 
        mnt_free_update(mtab_update);
index c53daa351295edcedfb72acd1f62d67b41a3e05d..83eb4fc4a12b7f2109e090254d45d95880abddae 100644 (file)
@@ -417,12 +417,9 @@ umount_one (const char *spec, const char *node, const char *type,
 #ifdef HAVE_LIBMOUNT_MOUNT
                struct libmnt_update *upd = mnt_new_update();
 
-               if (upd && !mnt_update_set_fs(upd, 0, node, NULL)) {
-                       struct libmnt_lock *lc = init_libmount_lock(
-                                               mnt_update_get_filename(upd));
-                       mnt_update_table(upd, lc);
-                       init_libmount_lock(NULL);
-               }
+               if (upd && !mnt_update_set_fs(upd, 0, node, NULL))
+                       mnt_update_table(upd, NULL);
+
                mnt_free_update(upd);
 #else
                update_mtab (node, NULL);