[PATCH] umount: do not sync() if nothing was unmounted

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

 



Hi all,

SUSE-based distributions have the following patch for some time. More
info here: https://bugzilla.novell.com/show_bug.cgi?id=447036

From the Novell bugzilla:
<quote>
> I cannot see any justification for that sync call at all so I'd
> probably just remove it.  Your
> patch is possibly safer so maybe it should be used as is.
</quote>

So, does anybody know why/if the sync() is actually needed?

BR,
Petr


From: Michael Meeks <mmeeks@xxxxxxxxxx>
Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 mount/umount.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/mount/umount.c b/mount/umount.c
index 6786ac5..a7a2cec 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -367,6 +367,7 @@ static int
 umount_all (char *types, char *test_opts) {
      struct mntentchn *mc, *hd;
      int errors = 0;
+     int do_sync = 0;
 
      hd = mtab_head();
      if (!hd->prev)
@@ -376,10 +377,12 @@ umount_all (char *types, char *test_opts) {
 	      && matching_opts (mc->m.mnt_opts, test_opts)) {
 	       errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir,
 				     mc->m.mnt_type, mc->m.mnt_opts, mc);
+	       do_sync = 1;
 	  }
      }
 
-     sync ();
+     if (do_sync)
+	sync ();
      return errors;
 }
 
-- 
1.6.4.2


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpTlGTukpPDR.pgp
Description: PGP signature


[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