mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Steven Whitehouse <swhiteho@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Benjamin Marzinski <bmarzins@redhat.com>
Subject: [PATCH 09/16] GFS2: O_(D)SYNC support for fallocate
Date: Thu,  5 Jan 2012 11:51:55 +0000	[thread overview]
Message-ID: <1325764322-10807-10-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1325764322-10807-1-git-send-email-swhiteho@redhat.com>

Add sync of metadata after fallocate for O_SYNC files to ensure that we
meet expectations for everything being on disk in this case.
Unfortunately, the offset and len parameters are modified during the
course of the fallocate function, so I've had to add a couple of new
variables to call generic_write_sync() at the end.

I know that potentially this will sync data as well within the range,
but I think that is a fairly harmless side-effect overall, since we
would not normally expect there to be any dirty data within the range in
question.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Benjamin Marzinski <bmarzins@redhat.com>

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 6336bc6..9b6c6ac 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -752,6 +752,8 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
 	loff_t bytes, max_bytes;
 	struct gfs2_alloc *al;
 	int error;
+	const loff_t pos = offset;
+	const loff_t count = len;
 	loff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1);
 	loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift;
 	loff_t max_chunk_size = UINT_MAX & bsize_mask;
@@ -834,6 +836,9 @@ retry:
 		gfs2_quota_unlock(ip);
 		gfs2_alloc_put(ip);
 	}
+
+	if (error == 0)
+		error = generic_write_sync(file, pos, count);
 	goto out_unlock;
 
 out_trans_fail:
-- 
1.7.4


  parent reply	other threads:[~2012-01-05 12:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 11:51 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2012-01-05 11:51 ` [PATCH 01/16] GFS2: Fix up REQ flags Steven Whitehouse
2012-01-05 11:51 ` [PATCH 02/16] GFS2: Add readahead to sequential directory traversal Steven Whitehouse
2012-01-05 11:51 ` [PATCH 03/16] GFS2: More automated code analysis fixes Steven Whitehouse
2012-01-05 11:51 ` [PATCH 04/16] GFS2: Fix very unlikley memory leak in ACL xattr code Steven Whitehouse
2012-01-05 11:51 ` [PATCH 05/16] GFS2: f_ra is always valid in dir readahead function Steven Whitehouse
2012-01-05 11:51 ` [PATCH 06/16] GFS2: Add non-try locks back to get_local_rgrp Steven Whitehouse
2012-01-05 11:51 ` [PATCH 07/16] GFS2: combine gfs2_alloc_block and gfs2_alloc_di Steven Whitehouse
2012-01-05 11:51 ` [PATCH 08/16] GFS2: remove vestigial al_alloced Steven Whitehouse
2012-01-05 11:51 ` Steven Whitehouse [this message]
2012-01-05 11:51 ` [PATCH 10/16] GFS2: move toward a generic multi-block allocator Steven Whitehouse
2012-01-05 11:51 ` [PATCH 11/16] GFS2: Fix up "off by one" in the previous patch Steven Whitehouse
2012-01-05 11:51 ` [PATCH 12/16] GFS2: split function rgblk_search Steven Whitehouse
2012-01-05 11:51 ` [PATCH 13/16] GFS2: decouple quota allocations from block allocations Steven Whitehouse
2012-01-05 11:52 ` [PATCH 14/16] GFS2: Fix multi-block allocation Steven Whitehouse
2012-01-05 11:52 ` [PATCH 15/16] GFS2: We only need one ACL getting function Steven Whitehouse
2012-01-05 11:52 ` [PATCH 16/16] GFS2: local functions should be static Steven Whitehouse

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=1325764322-10807-10-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®