aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
commitbbd9d6f7fbb0305c9a592bf05a32e87eb364a4ff (patch)
tree12b2bb4202b05f6ae6a43c6ce830a0472043dbe5 /fs/gfs2
parent8e204874db000928e37199c2db82b7eb8966cc3c (diff)
parent5a9a43646cf709312d71eca71cef90ad802f28f9 (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')
-rw-r--r--fs/gfs2/acl.c4
-rw-r--r--fs/gfs2/acl.h2
-rw-r--r--fs/gfs2/bmap.c2
-rw-r--r--fs/gfs2/file.c19
-rw-r--r--fs/gfs2/inode.c35
-rw-r--r--fs/gfs2/inode.h2
6 files changed, 36 insertions, 28 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index cbc07155b1a0..8ef1079f1665 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -75,12 +75,12 @@ static struct posix_acl *gfs2_acl_get(struct gfs2_inode *ip, int type)
75 * Returns: errno 75 * Returns: errno
76 */ 76 */
77 77
78int gfs2_check_acl(struct inode *inode, int mask, unsigned int flags) 78int gfs2_check_acl(struct inode *inode, int mask)
79{ 79{
80 struct posix_acl *acl; 80 struct posix_acl *acl;
81 int error; 81 int error;
82 82
83 if (flags & IPERM_FLAG_RCU) { 83 if (mask & MAY_NOT_BLOCK) {
84 if (!negative_cached_acl(inode, ACL_TYPE_ACCESS)) 84 if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
85 return -ECHILD; 85 return -ECHILD;
86 return -EAGAIN; 86 return -EAGAIN;
diff --git a/fs/gfs2/acl.h b/fs/gfs2/acl.h
index a93907c8159b..b522b0cb39ea 100644
--- a/fs/gfs2/acl.h
+++ b/fs/gfs2/acl.h
@@ -16,7 +16,7 @@
16#define GFS2_POSIX_ACL_DEFAULT "posix_acl_default" 16#define GFS2_POSIX_ACL_DEFAULT "posix_acl_default"
17#define GFS2_ACL_MAX_ENTRIES 25 17#define GFS2_ACL_MAX_ENTRIES 25
18 18
19extern int gfs2_check_acl(struct inode *inode, int mask, unsigned int); 19extern int gfs2_check_acl(struct inode *inode, int mask);
20extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode); 20extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode);
21extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); 21extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr);
22extern const struct xattr_handler gfs2_xattr_system_handler; 22extern const struct xattr_handler gfs2_xattr_system_handler;
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 42e477f31223..7878c473ae62 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1216,6 +1216,8 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
1216 if (ret) 1216 if (ret)
1217 return ret; 1217 return ret;
1218 1218
1219 inode_dio_wait(inode);
1220
1219 oldsize = inode->i_size; 1221 oldsize = inode->i_size;
1220 if (newsize >= oldsize) 1222 if (newsize >= oldsize)
1221 return do_grow(inode, newsize); 1223 return do_grow(inode, newsize);
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
558static int gfs2_fsync(struct file *file, int datasync) 560static 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
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 03e0c529063e..0fb51a96eff0 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -307,7 +307,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
307 } 307 }
308 308
309 if (!is_root) { 309 if (!is_root) {
310 error = gfs2_permission(dir, MAY_EXEC, 0); 310 error = gfs2_permission(dir, MAY_EXEC);
311 if (error) 311 if (error)
312 goto out; 312 goto out;
313 } 313 }
@@ -337,7 +337,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
337{ 337{
338 int error; 338 int error;
339 339
340 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC, 0); 340 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
341 if (error) 341 if (error)
342 return error; 342 return error;
343 343
@@ -792,13 +792,8 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
792static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, 792static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
793 struct nameidata *nd) 793 struct nameidata *nd)
794{ 794{
795 struct inode *inode = NULL; 795 struct inode *inode = gfs2_lookupi(dir, &dentry->d_name, 0);
796 796 if (inode && !IS_ERR(inode)) {
797 inode = gfs2_lookupi(dir, &dentry->d_name, 0);
798 if (inode && IS_ERR(inode))
799 return ERR_CAST(inode);
800
801 if (inode) {
802 struct gfs2_glock *gl = GFS2_I(inode)->i_gl; 797 struct gfs2_glock *gl = GFS2_I(inode)->i_gl;
803 struct gfs2_holder gh; 798 struct gfs2_holder gh;
804 int error; 799 int error;
@@ -808,11 +803,8 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
808 return ERR_PTR(error); 803 return ERR_PTR(error);
809 } 804 }
810 gfs2_glock_dq_uninit(&gh); 805 gfs2_glock_dq_uninit(&gh);
811 return d_splice_alias(inode, dentry);
812 } 806 }
813 d_add(dentry, inode); 807 return d_splice_alias(inode, dentry);
814
815 return NULL;
816} 808}
817 809
818/** 810/**
@@ -857,7 +849,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
857 if (inode->i_nlink == 0) 849 if (inode->i_nlink == 0)
858 goto out_gunlock; 850 goto out_gunlock;
859 851
860 error = gfs2_permission(dir, MAY_WRITE | MAY_EXEC, 0); 852 error = gfs2_permission(dir, MAY_WRITE | MAY_EXEC);
861 if (error) 853 if (error)
862 goto out_gunlock; 854 goto out_gunlock;
863 855
@@ -990,7 +982,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
990 if (IS_APPEND(&dip->i_inode)) 982 if (IS_APPEND(&dip->i_inode))
991 return -EPERM; 983 return -EPERM;
992 984
993 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC, 0); 985 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
994 if (error) 986 if (error)
995 return error; 987 return error;
996 988
@@ -1336,7 +1328,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1336 } 1328 }
1337 } 1329 }
1338 } else { 1330 } else {
1339 error = gfs2_permission(ndir, MAY_WRITE | MAY_EXEC, 0); 1331 error = gfs2_permission(ndir, MAY_WRITE | MAY_EXEC);
1340 if (error) 1332 if (error)
1341 goto out_gunlock; 1333 goto out_gunlock;
1342 1334
@@ -1371,7 +1363,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1371 /* Check out the dir to be renamed */ 1363 /* Check out the dir to be renamed */
1372 1364
1373 if (dir_rename) { 1365 if (dir_rename) {
1374 error = gfs2_permission(odentry->d_inode, MAY_WRITE, 0); 1366 error = gfs2_permission(odentry->d_inode, MAY_WRITE);
1375 if (error) 1367 if (error)
1376 goto out_gunlock; 1368 goto out_gunlock;
1377 } 1369 }
@@ -1543,7 +1535,7 @@ static void gfs2_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
1543 * Returns: errno 1535 * Returns: errno
1544 */ 1536 */
1545 1537
1546int gfs2_permission(struct inode *inode, int mask, unsigned int flags) 1538int gfs2_permission(struct inode *inode, int mask)
1547{ 1539{
1548 struct gfs2_inode *ip; 1540 struct gfs2_inode *ip;
1549 struct gfs2_holder i_gh; 1541 struct gfs2_holder i_gh;
@@ -1553,7 +1545,7 @@ int gfs2_permission(struct inode *inode, int mask, unsigned int flags)
1553 1545
1554 ip = GFS2_I(inode); 1546 ip = GFS2_I(inode);
1555 if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) { 1547 if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
1556 if (flags & IPERM_FLAG_RCU) 1548 if (mask & MAY_NOT_BLOCK)
1557 return -ECHILD; 1549 return -ECHILD;
1558 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); 1550 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
1559 if (error) 1551 if (error)
@@ -1564,7 +1556,7 @@ int gfs2_permission(struct inode *inode, int mask, unsigned int flags)
1564 if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode)) 1556 if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
1565 error = -EACCES; 1557 error = -EACCES;
1566 else 1558 else
1567 error = generic_permission(inode, mask, flags, gfs2_check_acl); 1559 error = generic_permission(inode, mask);
1568 if (unlock) 1560 if (unlock)
1569 gfs2_glock_dq_uninit(&i_gh); 1561 gfs2_glock_dq_uninit(&i_gh);
1570 1562
@@ -1854,6 +1846,7 @@ const struct inode_operations gfs2_file_iops = {
1854 .listxattr = gfs2_listxattr, 1846 .listxattr = gfs2_listxattr,
1855 .removexattr = gfs2_removexattr, 1847 .removexattr = gfs2_removexattr,
1856 .fiemap = gfs2_fiemap, 1848 .fiemap = gfs2_fiemap,
1849 .check_acl = gfs2_check_acl,
1857}; 1850};
1858 1851
1859const struct inode_operations gfs2_dir_iops = { 1852const struct inode_operations gfs2_dir_iops = {
@@ -1874,6 +1867,7 @@ const struct inode_operations gfs2_dir_iops = {
1874 .listxattr = gfs2_listxattr, 1867 .listxattr = gfs2_listxattr,
1875 .removexattr = gfs2_removexattr, 1868 .removexattr = gfs2_removexattr,
1876 .fiemap = gfs2_fiemap, 1869 .fiemap = gfs2_fiemap,
1870 .check_acl = gfs2_check_acl,
1877}; 1871};
1878 1872
1879const struct inode_operations gfs2_symlink_iops = { 1873const struct inode_operations gfs2_symlink_iops = {
@@ -1888,5 +1882,6 @@ const struct inode_operations gfs2_symlink_iops = {
1888 .listxattr = gfs2_listxattr, 1882 .listxattr = gfs2_listxattr,
1889 .removexattr = gfs2_removexattr, 1883 .removexattr = gfs2_removexattr,
1890 .fiemap = gfs2_fiemap, 1884 .fiemap = gfs2_fiemap,
1885 .check_acl = gfs2_check_acl,
1891}; 1886};
1892 1887
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 31606076f701..8d90e0c07672 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -108,7 +108,7 @@ extern int gfs2_inode_refresh(struct gfs2_inode *ip);
108 108
109extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, 109extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
110 int is_root); 110 int is_root);
111extern int gfs2_permission(struct inode *inode, int mask, unsigned int flags); 111extern int gfs2_permission(struct inode *inode, int mask);
112extern int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr); 112extern int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
113extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name); 113extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
114extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); 114extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);