diff options
-rw-r--r-- | resize/ChangeLog | 9 | ||||
-rw-r--r-- | resize/main.c | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/resize/ChangeLog b/resize/ChangeLog index 07ca8f41..6b727e9c 100644 --- a/resize/ChangeLog +++ b/resize/ChangeLog @@ -1,3 +1,12 @@ +2006-03-18 Theodore Ts'o <tytso@mit.edu> + + * main.c (main): If the filesystem is mounted, open it in + read-only mode since the userspace program should not try + to modify it directly. If the filesystem is not mounted, + open it in exclusive mode to avoid potential problems + (such as someone trying to mount the filesystem while it + is being resized). + 2006-03-17 Theodore Ts'o <tytso@mit.edu> * resize2fs.8.in: Update manpage to document that that resize2fs diff --git a/resize/main.c b/resize/main.c index d6ddaa71..e202c5f7 100644 --- a/resize/main.c +++ b/resize/main.c @@ -102,6 +102,7 @@ int main (int argc, char ** argv) int flags = 0; int flush = 0; int force = 0; + int io_flags = 0; int fd, ret; blk_t new_size = 0; blk_t max_size = 0; @@ -234,7 +235,9 @@ int main (int argc, char ** argv) } else io_ptr = unix_io_manager; - retval = ext2fs_open2(device_name, io_options, EXT2_FLAG_RW, + if (!(mount_flags & EXT2_MF_MOUNTED)) + io_flags = EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE; + retval = ext2fs_open2(device_name, io_options, io_flags, 0, 0, io_ptr, &fs); if (retval) { com_err (program_name, retval, _("while trying to open %s"), |