mtab lock vol 2.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi,

 I commited a patch to lock_mtab() few minutes ago. You can found it
 at:

    http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=commit;h=dc8fdc57cd3ba0658cf4ab05031695c2d2965f93

 (there is also commit 2cd72ac0e054bb070cad880d0cc9366ebf08b3eb with
 mtab lock test)

 It's based on RH patch, I've thought about Dieter's patch, but I
 think less changes is better for now. And after util-linux-ng release
 I'm going to continue to work on libmount and it's right place for a
 final version of mtab locking code.

 The patch is mostly changing the way how lock_mtab() is working with
 timeouts. It doesn't count number of attempts anymore. Now there is
 time limit only. -- The problem with F_SETLK/F_SETLKW is more hidden
 now ;-). I can successfully run 300 concurrent processes.

 I also found nasty bug in lock_mtab(), that's very probably reason
 why we occasionally see corrupted /etc/mtab on machines with many
 concurrent mount processes. This bug is not fixed in any Linux
 distrubution. (I have to inform nfs-utils and am-utils upstream too.)
 If you have care about /etc/mtab, please use:

diff --git a/mount/fstab.c b/mount/fstab.c
index 2de44e6..42701b4 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -503,8 +503,10 @@ lock_mtab (void) {
 		if (fd < 0) {
 			int errsv = errno;
 			/* Strange... Maybe the file was just deleted? */
-			if (errno == ENOENT && tries-- > 0)
+			if (errno == ENOENT && tries-- > 0) {
+				we_created_lockfile = 0;
 				continue;
+			}
 			die (EX_FILEIO, _("can't open lock file %s: %s "
 			     "(use -n flag to override)"),
 			     MOUNTED_LOCK, strerror (errsv));

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux