From: Konstantin Chistyakov <Konstantin.Chistyakov@paragon-software.com>
To: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: [PATCH] libext2fs: don't flush to device opened in read-only mode
Date: Mon, 22 May 2017 09:48:00 +0000 [thread overview]
Message-ID: <118AAB5F26BFB34DB5CDA7DA33334DB9B5FF41@vmsk-exch-01.paragon-software.com> (raw)
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:
...
e2fsck -n -f /dev/sdd1
e2fsck 1.43.4 (31-Jan-2017)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Error flushing writes to storage device: Permission denied
---
lib/ext2fs/unix_io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'lib/ext2fs/unix_io.c')
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;
}
next reply other threads:[~2017-05-22 9:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 9:48 Konstantin Chistyakov [this message]
2017-05-24 21:56 ` libext2fs: don't flush to device opened in read-only mode Theodore Ts'o
2017-05-25 5:50 ` Konstantin Chistyakov
2017-05-25 12:12 ` Konstantin Chistyakov
2017-05-29 23:43 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=118AAB5F26BFB34DB5CDA7DA33334DB9B5FF41@vmsk-exch-01.paragon-software.com \
--to=konstantin.chistyakov@paragon-software.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox