diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 7c9f7598807f..97615cc74ef5 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
| @@ -324,6 +324,17 @@ xfs_file_open( | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | STATIC int | 326 | STATIC int |
| 327 | xfs_file_close( | ||
| 328 | struct file *filp) | ||
| 329 | { | ||
| 330 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | ||
| 331 | int error; | ||
| 332 | |||
| 333 | VOP_CLOSE(vp, 0, file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL, error); | ||
| 334 | return -error; | ||
| 335 | } | ||
| 336 | |||
| 337 | STATIC int | ||
| 327 | xfs_file_release( | 338 | xfs_file_release( |
| 328 | struct inode *inode, | 339 | struct inode *inode, |
| 329 | struct file *filp) | 340 | struct file *filp) |
| @@ -349,6 +360,8 @@ xfs_file_fsync( | |||
| 349 | 360 | ||
| 350 | if (datasync) | 361 | if (datasync) |
| 351 | flags |= FSYNC_DATA; | 362 | flags |= FSYNC_DATA; |
| 363 | if (VN_TRUNC(vp)) | ||
| 364 | VUNTRUNCATE(vp); | ||
| 352 | VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); | 365 | VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); |
| 353 | return -error; | 366 | return -error; |
| 354 | } | 367 | } |
| @@ -578,6 +591,7 @@ const struct file_operations xfs_file_operations = { | |||
| 578 | #endif | 591 | #endif |
| 579 | .mmap = xfs_file_mmap, | 592 | .mmap = xfs_file_mmap, |
| 580 | .open = xfs_file_open, | 593 | .open = xfs_file_open, |
| 594 | .flush = xfs_file_close, | ||
| 581 | .release = xfs_file_release, | 595 | .release = xfs_file_release, |
| 582 | .fsync = xfs_file_fsync, | 596 | .fsync = xfs_file_fsync, |
| 583 | #ifdef HAVE_FOP_OPEN_EXEC | 597 | #ifdef HAVE_FOP_OPEN_EXEC |
| @@ -602,6 +616,7 @@ const struct file_operations xfs_invis_file_operations = { | |||
| 602 | #endif | 616 | #endif |
| 603 | .mmap = xfs_file_mmap, | 617 | .mmap = xfs_file_mmap, |
| 604 | .open = xfs_file_open, | 618 | .open = xfs_file_open, |
| 619 | .flush = xfs_file_close, | ||
| 605 | .release = xfs_file_release, | 620 | .release = xfs_file_release, |
| 606 | .fsync = xfs_file_fsync, | 621 | .fsync = xfs_file_fsync, |
| 607 | }; | 622 | }; |
