linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Bail early when clearing inode journal flag fails
@ 2014-10-23 13:05 Jan Kara
  2014-10-30 14:36 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2014-10-23 13:05 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Jan Kara

When clearing inode journal flag, we call jbd2_journal_flush() to force
all the journalled data to their final locations. Currently we ignore
when this fails and continue clearing inode journal flag. This isn't a
big problem because when jbd2_journal_flush() fails, journal is likely
aborted anyway. But it can still lead to somewhat confusing results so
rather bail out early.

Coverity-id: 989044
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/inode.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e9777f93cf05..3356ab5395f4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4959,7 +4959,12 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
 	if (val)
 		ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
 	else {
-		jbd2_journal_flush(journal);
+		err = jbd2_journal_flush(journal);
+		if (err < 0) {
+			jbd2_journal_unlock_updates(journal);
+			ext4_inode_resume_unlocked_dio(inode);
+			return err;
+		}
 		ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA);
 	}
 	ext4_set_aops(inode);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Bail early when clearing inode journal flag fails
  2014-10-23 13:05 [PATCH] ext4: Bail early when clearing inode journal flag fails Jan Kara
@ 2014-10-30 14:36 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2014-10-30 14:36 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4

On Thu, Oct 23, 2014 at 03:05:43PM +0200, Jan Kara wrote:
> When clearing inode journal flag, we call jbd2_journal_flush() to force
> all the journalled data to their final locations. Currently we ignore
> when this fails and continue clearing inode journal flag. This isn't a
> big problem because when jbd2_journal_flush() fails, journal is likely
> aborted anyway. But it can still lead to somewhat confusing results so
> rather bail out early.
> 
> Coverity-id: 989044
> Signed-off-by: Jan Kara <jack@suse.cz>

Applied, thanks.

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-30 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 13:05 [PATCH] ext4: Bail early when clearing inode journal flag fails Jan Kara
2014-10-30 14:36 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).