diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 22:02:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-22 22:02:39 -0400 |
commit | bbd9d6f7fbb0305c9a592bf05a32e87eb364a4ff (patch) | |
tree | 12b2bb4202b05f6ae6a43c6ce830a0472043dbe5 /fs/gfs2/file.c | |
parent | 8e204874db000928e37199c2db82b7eb8966cc3c (diff) | |
parent | 5a9a43646cf709312d71eca71cef90ad802f28f9 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (107 commits)
vfs: use ERR_CAST for err-ptr tossing in lookup_instantiate_filp
isofs: Remove global fs lock
jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory
fix IN_DELETE_SELF on overwriting rename() on ramfs et.al.
mm/truncate.c: fix build for CONFIG_BLOCK not enabled
fs:update the NOTE of the file_operations structure
Remove dead code in dget_parent()
AFS: Fix silly characters in a comment
switch d_add_ci() to d_splice_alias() in "found negative" case as well
simplify gfs2_lookup()
jfs_lookup(): don't bother with . or ..
get rid of useless dget_parent() in btrfs rename() and link()
get rid of useless dget_parent() in fs/btrfs/ioctl.c
fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers
drivers: fix up various ->llseek() implementations
fs: handle SEEK_HOLE/SEEK_DATA properly in all fs's that define their own llseek
Ext4: handle SEEK_HOLE/SEEK_DATA generically
Btrfs: implement our own ->llseek
fs: add SEEK_HOLE and SEEK_DATA flags
reiserfs: make reiserfs default to barrier=flush
...
Fix up trivial conflicts in fs/xfs/linux-2.6/xfs_super.c due to the new
shrinker callout for the inode cache, that clashed with the xfs code to
start the periodic workers later.
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r-- | fs/gfs2/file.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index bc2590ef5fc1..edeb9e802903 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -245,7 +245,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | |||
245 | !capable(CAP_LINUX_IMMUTABLE)) | 245 | !capable(CAP_LINUX_IMMUTABLE)) |
246 | goto out; | 246 | goto out; |
247 | if (!IS_IMMUTABLE(inode)) { | 247 | if (!IS_IMMUTABLE(inode)) { |
248 | error = gfs2_permission(inode, MAY_WRITE, 0); | 248 | error = gfs2_permission(inode, MAY_WRITE); |
249 | if (error) | 249 | if (error) |
250 | goto out; | 250 | goto out; |
251 | } | 251 | } |
@@ -546,7 +546,9 @@ static int gfs2_close(struct inode *inode, struct file *file) | |||
546 | 546 | ||
547 | /** | 547 | /** |
548 | * gfs2_fsync - sync the dirty data for a file (across the cluster) | 548 | * gfs2_fsync - sync the dirty data for a file (across the cluster) |
549 | * @file: the file that points to the dentry (we ignore this) | 549 | * @file: the file that points to the dentry |
550 | * @start: the start position in the file to sync | ||
551 | * @end: the end position in the file to sync | ||
550 | * @datasync: set if we can ignore timestamp changes | 552 | * @datasync: set if we can ignore timestamp changes |
551 | * | 553 | * |
552 | * The VFS will flush data for us. We only need to worry | 554 | * The VFS will flush data for us. We only need to worry |
@@ -555,23 +557,32 @@ static int gfs2_close(struct inode *inode, struct file *file) | |||
555 | * Returns: errno | 557 | * Returns: errno |
556 | */ | 558 | */ |
557 | 559 | ||
558 | static int gfs2_fsync(struct file *file, int datasync) | 560 | static int gfs2_fsync(struct file *file, loff_t start, loff_t end, |
561 | int datasync) | ||
559 | { | 562 | { |
560 | struct inode *inode = file->f_mapping->host; | 563 | struct inode *inode = file->f_mapping->host; |
561 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); | 564 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); |
562 | struct gfs2_inode *ip = GFS2_I(inode); | 565 | struct gfs2_inode *ip = GFS2_I(inode); |
563 | int ret; | 566 | int ret; |
564 | 567 | ||
568 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | ||
569 | if (ret) | ||
570 | return ret; | ||
571 | mutex_lock(&inode->i_mutex); | ||
572 | |||
565 | if (datasync) | 573 | if (datasync) |
566 | sync_state &= ~I_DIRTY_SYNC; | 574 | sync_state &= ~I_DIRTY_SYNC; |
567 | 575 | ||
568 | if (sync_state) { | 576 | if (sync_state) { |
569 | ret = sync_inode_metadata(inode, 1); | 577 | ret = sync_inode_metadata(inode, 1); |
570 | if (ret) | 578 | if (ret) { |
579 | mutex_unlock(&inode->i_mutex); | ||
571 | return ret; | 580 | return ret; |
581 | } | ||
572 | gfs2_ail_flush(ip->i_gl); | 582 | gfs2_ail_flush(ip->i_gl); |
573 | } | 583 | } |
574 | 584 | ||
585 | mutex_unlock(&inode->i_mutex); | ||
575 | return 0; | 586 | return 0; |
576 | } | 587 | } |
577 | 588 | ||