]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Check for a busy device when creating a journal.
authorTheodore Ts'o <tytso@mit.edu>
Tue, 19 Jul 2005 20:04:22 +0000 (15:04 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 19 Jul 2005 20:04:22 +0000 (15:04 -0500)
In ext2fs_add_journal_inode() check for the case where the filesystem
appears to be unmounted, but the device is still apparently busy.
This can happen when the luser doesn't bother to mount /proc and has a
bogus /etc/mtab, but still wants to mount the filesystem before using
tune2fs(?!?).  Add a safety check to save him from his own stupidity,
at least on 2.6 kernels.  (Addresses Debian Bug #319002)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/ChangeLog
lib/ext2fs/mkjournal.c

index 58e29a9b314ab0915a9f33cec99e9c75538e1702..b586a6b267873585ff2b142320b10a889cfa326e 100644 (file)
@@ -1,3 +1,12 @@
+2005-07-19  Theodore Ts'o  <tytso@mit.edu>
+
+       * mkjournal.c (ext2fs_add_journal_inode): Check for the case where
+               the filesystem is apparently not mounted, but the device
+               is still busy.  This can happy when the luser doesn't
+               bother to mount /proc and has a bogus /etc/mtab.  Add a
+               safety check to save him from his own stupidity, at least
+               on 2.6 kernels.  (Addresses Debian Bug #319002)
+
 2005-07-09  Andreas Dilger <adilger@clusterfs.com>
 
        * getsize.c (ext2fs_get_device_size): Use fstat/fstat64 to get
index 427a08e722b09780f87bd310df5730706faf3137..76ed5cbbe842c67f15315cae2ff34b0a07abd9e5 100644 (file)
@@ -369,6 +369,10 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
                close(fd);
                journal_ino = st.st_ino;
        } else {
+               if (mount_flags & EXT2_MF_BUSY) {
+                       retval = EBUSY;
+                       goto errout;
+               }
                journal_ino = EXT2_JOURNAL_INO;
                if ((retval = write_journal_inode(fs, journal_ino,
                                                  size, flags)))