Message ID | 118AAB5F26BFB34DB5CDA7DA33334DB9B5FF41@vmsk-exch-01.paragon-software.com |
---|---|
State | Superseded, archived |
Headers | show |
On Mon, May 22, 2017 at 09:48:00AM +0000, Konstantin Chistyakov wrote: > From: Konstantin Chistyakov <Konstantin.Chistyakov@Paragon-software.com> > Date: Tue, 19 May 2017 09:23:29 -0600 > Subject: [PATCH] libext2fs: don't flush to device opened in read-only mode > > From: Konstantin Chistyakov <Konstantin.Chistyakov@Paragon-software.com> > > If the e2fsck is called with both -f -n options, the checking completing with a flushing error (retcode 8). > > Catch error from the unix_flush() fsync(data->dev) when data->dev is opened in read-only mode: I can't reproduce this problem. What storage device or operating system are you using? That being said, this is probably the wrong place to fix it. The better fix is in e2fsck/unix.c, by adding a read-only test. - Ted
Thanks for suggestion how to fix the bug correctly. Platform for reproducing: CYGWin build (x86, x64, cygwin1.dll v.2.8.0), Windows 8.1 x64 and Windows 10 x64 (x86 not tested). -----Original Message----- From: Theodore Ts'o [mailto:tytso@mit.edu] Sent: Thursday, May 25, 2017 12:56 AM To: Konstantin Chistyakov <Konstantin.Chistyakov@paragon-software.com> Cc: linux-ext4@vger.kernel.org Subject: Re: libext2fs: don't flush to device opened in read-only mode On Mon, May 22, 2017 at 09:48:00AM +0000, Konstantin Chistyakov wrote: > From: Konstantin Chistyakov > <Konstantin.Chistyakov@Paragon-software.com> > Date: Tue, 19 May 2017 09:23:29 -0600 > Subject: [PATCH] libext2fs: don't flush to device opened in read-only > mode > > From: Konstantin Chistyakov > <Konstantin.Chistyakov@Paragon-software.com> > > If the e2fsck is called with both -f -n options, the checking completing with a flushing error (retcode 8). > > Catch error from the unix_flush() fsync(data->dev) when data->dev is opened in read-only mode: I can't reproduce this problem. What storage device or operating system are you using? That being said, this is probably the wrong place to fix it. The better fix is in e2fsck/unix.c, by adding a read-only test. - Ted
diff -up lib/ext2fs/unix_io.c{.orig,} --- lib/ext2fs/unix_io.c.orig 2017-05-19 14:32:12.550414900 +0300 +++ lib/ext2fs/unix_io.c 2017-05-19 14:33:48.520878000 +0300 @@ -1030,7 +1030,7 @@ static errcode_t unix_flush(io_channel channel) #ifndef NO_IO_CACHE retval = flush_cached_blocks(channel, data, 0); #endif - if (!retval && fsync(data->dev) != 0) + if (!retval && (data->flags & IO_FLAG_RW) && fsync(data->dev) != 0) return errno; return retval; }