All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Fix quota file corruption
Date: Wed, 19 Feb 2014 14:11:02 +0100	[thread overview]
Message-ID: <1392815462-9522-1-git-send-email-jack@suse.cz> (raw)

Global quota files are accessed from different nodes and reading and
writing of these files happens via block device page cache. Thus even
though the access between nodes is properly serialized by quota file's
inode lock we cannot rely on consistency of block device page cache
between nodes. Indeed currently it is possible to corrupt quota files by
creating and deleting quota structures from two nodes in parallel. Fix
the problem by using OCFS2_BH_IGNORE_CACHE mount option when reading
from quota file.

CC: Goldwyn Rodrigues <rgoldwyn@suse.de>
CC: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/quota_global.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

  This is a quick fix for quota file corruption I have found during my testing
(to be used for 3.13 and -stable kernels). Longer term we likely want to do
something more clever. Ideally we would invalidate relevant blocks from buffer
cache when node releases quota file's inode lock (similarly as we do it for
page cache). I wanted to do it similarly as for e.g. extent tree blocks but
I failed to find how consistency of those between nodes is achieved. Can
anyone point me in the right direction? Thanks in advance.

diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index aaa50611ec66..f1f0cca15db6 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -151,7 +151,8 @@ int ocfs2_read_quota_phys_block(struct inode *inode, u64 p_block,
 	int rc;
 
 	*bhp = NULL;
-	rc = ocfs2_read_blocks(INODE_CACHE(inode), p_block, 1, bhp, 0,
+	rc = ocfs2_read_blocks(INODE_CACHE(inode), p_block, 1, bhp,
+			       OCFS2_BH_IGNORE_CACHE,
 			       ocfs2_validate_quota_block);
 	if (rc)
 		mlog_errno(rc);
-- 
1.8.1.4

             reply	other threads:[~2014-02-19 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 13:11 Jan Kara [this message]
2014-02-19 14:48 ` [Ocfs2-devel] [PATCH] ocfs2: Fix quota file corruption Jan Kara
2014-02-19 17:56   ` Marty Sweet
2014-02-19 21:18     ` Jan Kara
2014-02-20 11:39 Jan Kara
2014-02-24 22:28 ` Mark Fasheh
2014-10-10 14:23 [PATCH 0/2 v2] Fix data corruption when blocksize < pagesize for mmapped data Jan Kara
2014-10-10 14:23 ` [Ocfs2-devel] [PATCH] ocfs2: Fix quota file corruption Jan Kara

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=1392815462-9522-1-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.