linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Brandenburg <martin@omnibond.com>
To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Martin Brandenburg <martin@omnibond.com>
Subject: [PATCH 10/10] orangefs: do not check possibly stale size on truncate
Date: Fri,  7 Apr 2017 17:17:12 -0400	[thread overview]
Message-ID: <1491599832-17773-11-git-send-email-martin@omnibond.com> (raw)
In-Reply-To: <1491599832-17773-1-git-send-email-martin@omnibond.com>

Let the server figure this out because our size might be out of date or
not present.

The bug was that

	xfs_io -f -t -c "pread -v 0 100" /mnt/foo
	echo "Test" > /mnt/foo
	xfs_io -f -t -c "pread -v 0 100" /mnt/foo

fail because the second truncate did not happen if nothing had requested
the size after the write in echo.  Thus i_size was zero (not present)
and the orangefs_setattr though i_size was zero and there was nothing to
do.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index ee28364..7f82e56 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -218,8 +218,7 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr)
 	if (ret)
 		goto out;
 
-	if ((iattr->ia_valid & ATTR_SIZE) &&
-	    iattr->ia_size != i_size_read(inode)) {
+	if (iattr->ia_valid & ATTR_SIZE) {
 		ret = orangefs_setattr_size(inode, iattr);
 		if (ret)
 			goto out;
-- 
2.1.4

      parent reply	other threads:[~2017-04-07 21:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 21:17 [PATCH 00/10] orangefs changes for 4.12 Martin Brandenburg
2017-04-07 21:17 ` [PATCH 01/10] orangefs: remove unused get_fsid_from_ino Martin Brandenburg
2017-04-07 21:17 ` [PATCH 02/10] orangefs: fix bounds check for listxattr Martin Brandenburg
2017-04-07 21:17 ` [PATCH 03/10] orangefs: clean up oversize xattr validation Martin Brandenburg
2017-04-07 21:17 ` [PATCH 04/10] orangefs: do not set getattr_time on orangefs_lookup Martin Brandenburg
2017-04-07 21:17 ` [PATCH 05/10] orangefs: rewrite readdir to fix several bugs Martin Brandenburg
2017-04-07 21:17 ` [PATCH 06/10] orangefs: support llseek on directories Martin Brandenburg
2017-04-07 21:17 ` [PATCH 07/10] orangefs: support very large directories Martin Brandenburg
2017-04-07 21:17 ` [PATCH 08/10] orangefs: remove ORANGEFS_READDIR macros Martin Brandenburg
2017-04-07 21:17 ` [PATCH 09/10] orangefs: implement statx Martin Brandenburg
2017-04-07 21:17 ` Martin Brandenburg [this message]

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=1491599832-17773-11-git-send-email-martin@omnibond.com \
    --to=martin@omnibond.com \
    --cc=hubcap@omnibond.com \
    --cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).