Linux ocfs2 filesystem development
 help / color / mirror / Atom feed
From: Younger Liu <younger.liucn@gmail.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix ocfs2_sync_file() if filesystem is readonly
Date: Mon, 25 Nov 2013 19:03:15 +0800	[thread overview]
Message-ID: <52932E73.5090902@gmail.com> (raw)


  If filesystem is readonly, there is no need to flush drive's caches
or force any uncommitted transactions.

Signed-off-by: Younger Liu <younger.liucn@gmail.com>
---
 fs/ocfs2/file.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d54d1bf..618f18f 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -185,6 +185,9 @@ static int ocfs2_sync_file(struct file *file, loff_t
start, loff_t end,
 			      file->f_path.dentry->d_name.name,
 			      (unsigned long long)datasync);

+	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
+		return 0;
+
 	err = filemap_write_and_wait_range(inode->i_mapping, start, end);
 	if (err)
 		return err;
-- 
1.7.9.5

                 reply	other threads:[~2013-11-25 11:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=52932E73.5090902@gmail.com \
    --to=younger.liucn@gmail.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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