From: David Chinner <dgc@sgi.com>
To: xfs-dev <xfs-dev@sgi.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Review: Make xfs_dm_sync_by_handle really sync data
Date: Fri, 30 Mar 2007 10:33:23 +1100 [thread overview]
Message-ID: <20070329233323.GM32597093@melbourne.sgi.com> (raw)
xfs_dm_sync_by_handle doesn't sync data right now. Never has.
It is supposed to work exactly like fsync(), except that it
only ever calls XFS functions that log the inode and
not the generic functions that actually sync out the data.
Fix it.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
---
fs/xfs/dmapi/xfs_dm.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
Index: 2.6.x-xfs-new/fs/xfs/dmapi/xfs_dm.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/dmapi/xfs_dm.c 2007-03-30 09:02:07.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/dmapi/xfs_dm.c 2007-03-30 09:28:54.348239386 +1000
@@ -3054,22 +3054,36 @@ xfs_dm_symlink_by_handle(
}
+/*
+ * xfs_dm_sync_by_handle needs to do the same thing as sys_fsync()
+ */
STATIC int
xfs_dm_sync_by_handle(
struct inode *inode,
dm_right_t right)
{
+ int err, ret;
bhv_vnode_t *vp = vn_from_inode(inode);
/* Returns negative errors to DMAPI */
-
if (right < DM_RIGHT_EXCL)
return(-EACCES);
+ /* We need to protect against concurrent writers.. */
+ ret = filemap_fdatawrite(inode->i_mapping);
+ down_rw_sems(inode, DM_FLAGS_IMUX);
+ err = bhv_vop_fsync(vp, FSYNC_WAIT, NULL, (xfs_off_t)0,(xfs_off_t)-1);
+ if (!ret)
+ ret = err;
+ up_rw_sems(inode, DM_FLAGS_IMUX);
+ err = filemap_fdatawait(inode->i_mapping);
+ if (!ret)
+ ret = err;
+
if (VN_TRUNC(vp))
VUNTRUNCATE(vp);
- return -bhv_vop_fsync(vp, FSYNC_WAIT, NULL, (xfs_off_t)0,(xfs_off_t)-1);
+ return(-ret); /* Return negative error to DMAPI */
}
next reply other threads:[~2007-03-29 23:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-29 23:33 David Chinner [this message]
2007-03-30 0:47 ` Review: Make xfs_dm_sync_by_handle really sync data Vlad Apostolov
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=20070329233323.GM32597093@melbourne.sgi.com \
--to=dgc@sgi.com \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.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