diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-16 10:47:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-16 10:47:04 -0400 |
commit | 37504a3be90b69438426d74ccf467a9fe192932b (patch) | |
tree | ef43f4d5f614ceb0b58319c7f7ce16fc51c133a0 /fs | |
parent | a060dc5010ffa32f3a83e5336f6eeb6551fa137a (diff) | |
parent | cfb2f9d5c921e38b0f12bb26fed10b877664444d (diff) |
Merge tag 'gfs2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes
Pull gfs2 fixes from Steven Whitehouse:
"Here are a number of small fixes for GFS2.
There is a fix for FIEMAP on large sparse files, a negative dentry
hashing fix, a fix for flock, and a bug fix relating to d_splice_alias
usage.
There are also (patches 1 and 5) a couple of updates which are less
critical, but small and low risk"
* tag 'gfs2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes:
GFS2: fix d_splice_alias() misuses
GFS2: Don't use MAXQUOTAS value
GFS2: Hash the negative dentry during inode lookup
GFS2: Request demote when a "try" flock fails
GFS2: Change maxlen variables to size_t
GFS2: fs/gfs2/super.c: replace seq_printf by seq_puts
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/bmap.c | 9 | ||||
-rw-r--r-- | fs/gfs2/file.c | 15 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 7 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 9 | ||||
-rw-r--r-- | fs/gfs2/super.c | 20 |
5 files changed, 38 insertions, 22 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index e6ee5b6e8d99..f0b945ab853e 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) | |||
359 | * Returns: The length of the extent (minimum of one block) | 359 | * Returns: The length of the extent (minimum of one block) |
360 | */ | 360 | */ |
361 | 361 | ||
362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) | 362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) |
363 | { | 363 | { |
364 | const __be64 *end = (start + len); | 364 | const __be64 *end = (start + len); |
365 | const __be64 *first = ptr; | 365 | const __be64 *first = ptr; |
@@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
449 | struct buffer_head *bh_map, struct metapath *mp, | 449 | struct buffer_head *bh_map, struct metapath *mp, |
450 | const unsigned int sheight, | 450 | const unsigned int sheight, |
451 | const unsigned int height, | 451 | const unsigned int height, |
452 | const unsigned int maxlen) | 452 | const size_t maxlen) |
453 | { | 453 | { |
454 | struct gfs2_inode *ip = GFS2_I(inode); | 454 | struct gfs2_inode *ip = GFS2_I(inode); |
455 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 455 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
483 | } else { | 483 | } else { |
484 | /* Need to allocate indirect blocks */ | 484 | /* Need to allocate indirect blocks */ |
485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; | 485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; |
486 | dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); | 486 | dblks = min(maxlen, (size_t)(ptrs_per_blk - |
487 | mp->mp_list[end_of_metadata])); | ||
487 | if (height == ip->i_height) { | 488 | if (height == ip->i_height) { |
488 | /* Writing into existing tree, extend tree down */ | 489 | /* Writing into existing tree, extend tree down */ |
489 | iblks = height - sheight; | 490 | iblks = height - sheight; |
@@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, | |||
605 | struct gfs2_inode *ip = GFS2_I(inode); | 606 | struct gfs2_inode *ip = GFS2_I(inode); |
606 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 607 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
607 | unsigned int bsize = sdp->sd_sb.sb_bsize; | 608 | unsigned int bsize = sdp->sd_sb.sb_bsize; |
608 | const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; | 609 | const size_t maxlen = bh_map->b_size >> inode->i_blkbits; |
609 | const u64 *arr = sdp->sd_heightsize; | 610 | const u64 *arr = sdp->sd_heightsize; |
610 | __be64 *ptr; | 611 | __be64 *ptr; |
611 | u64 size; | 612 | u64 size; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 26b3f952e6b1..7f4ed3daa38c 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/dlm.h> | 26 | #include <linux/dlm.h> |
27 | #include <linux/dlm_plock.h> | 27 | #include <linux/dlm_plock.h> |
28 | #include <linux/aio.h> | 28 | #include <linux/aio.h> |
29 | #include <linux/delay.h> | ||
29 | 30 | ||
30 | #include "gfs2.h" | 31 | #include "gfs2.h" |
31 | #include "incore.h" | 32 | #include "incore.h" |
@@ -979,9 +980,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
979 | unsigned int state; | 980 | unsigned int state; |
980 | int flags; | 981 | int flags; |
981 | int error = 0; | 982 | int error = 0; |
983 | int sleeptime; | ||
982 | 984 | ||
983 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; | 985 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; |
984 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT; | 986 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT; |
985 | 987 | ||
986 | mutex_lock(&fp->f_fl_mutex); | 988 | mutex_lock(&fp->f_fl_mutex); |
987 | 989 | ||
@@ -1001,7 +1003,14 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
1001 | gfs2_holder_init(gl, state, flags, fl_gh); | 1003 | gfs2_holder_init(gl, state, flags, fl_gh); |
1002 | gfs2_glock_put(gl); | 1004 | gfs2_glock_put(gl); |
1003 | } | 1005 | } |
1004 | error = gfs2_glock_nq(fl_gh); | 1006 | for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) { |
1007 | error = gfs2_glock_nq(fl_gh); | ||
1008 | if (error != GLR_TRYFAILED) | ||
1009 | break; | ||
1010 | fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT; | ||
1011 | fl_gh->gh_error = 0; | ||
1012 | msleep(sleeptime); | ||
1013 | } | ||
1005 | if (error) { | 1014 | if (error) { |
1006 | gfs2_holder_uninit(fl_gh); | 1015 | gfs2_holder_uninit(fl_gh); |
1007 | if (error == GLR_TRYFAILED) | 1016 | if (error == GLR_TRYFAILED) |
@@ -1024,7 +1033,7 @@ static void do_unflock(struct file *file, struct file_lock *fl) | |||
1024 | mutex_lock(&fp->f_fl_mutex); | 1033 | mutex_lock(&fp->f_fl_mutex); |
1025 | flock_lock_file_wait(file, fl); | 1034 | flock_lock_file_wait(file, fl); |
1026 | if (fl_gh->gh_gl) { | 1035 | if (fl_gh->gh_gl) { |
1027 | gfs2_glock_dq_wait(fl_gh); | 1036 | gfs2_glock_dq(fl_gh); |
1028 | gfs2_holder_uninit(fl_gh); | 1037 | gfs2_holder_uninit(fl_gh); |
1029 | } | 1038 | } |
1030 | mutex_unlock(&fp->f_fl_mutex); | 1039 | mutex_unlock(&fp->f_fl_mutex); |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 67d310c9ada3..39e7e9959b74 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -262,6 +262,9 @@ struct gfs2_holder { | |||
262 | unsigned long gh_ip; | 262 | unsigned long gh_ip; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* Number of quota types we support */ | ||
266 | #define GFS2_MAXQUOTAS 2 | ||
267 | |||
265 | /* Resource group multi-block reservation, in order of appearance: | 268 | /* Resource group multi-block reservation, in order of appearance: |
266 | 269 | ||
267 | Step 1. Function prepares to write, allocates a mb, sets the size hint. | 270 | Step 1. Function prepares to write, allocates a mb, sets the size hint. |
@@ -282,8 +285,8 @@ struct gfs2_blkreserv { | |||
282 | u64 rs_inum; /* Inode number for reservation */ | 285 | u64 rs_inum; /* Inode number for reservation */ |
283 | 286 | ||
284 | /* ancillary quota stuff */ | 287 | /* ancillary quota stuff */ |
285 | struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS]; | 288 | struct gfs2_quota_data *rs_qa_qd[2 * GFS2_MAXQUOTAS]; |
286 | struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS]; | 289 | struct gfs2_holder rs_qa_qd_ghs[2 * GFS2_MAXQUOTAS]; |
287 | unsigned int rs_qa_qd_num; | 290 | unsigned int rs_qa_qd_num; |
288 | }; | 291 | }; |
289 | 292 | ||
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e62e59477884..fc8ac2ee0667 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -626,8 +626,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
626 | if (!IS_ERR(inode)) { | 626 | if (!IS_ERR(inode)) { |
627 | d = d_splice_alias(inode, dentry); | 627 | d = d_splice_alias(inode, dentry); |
628 | error = PTR_ERR(d); | 628 | error = PTR_ERR(d); |
629 | if (IS_ERR(d)) | 629 | if (IS_ERR(d)) { |
630 | inode = ERR_CAST(d); | ||
630 | goto fail_gunlock; | 631 | goto fail_gunlock; |
632 | } | ||
631 | error = 0; | 633 | error = 0; |
632 | if (file) { | 634 | if (file) { |
633 | if (S_ISREG(inode->i_mode)) { | 635 | if (S_ISREG(inode->i_mode)) { |
@@ -840,8 +842,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
840 | int error; | 842 | int error; |
841 | 843 | ||
842 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); | 844 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); |
843 | if (!inode) | 845 | if (inode == NULL) { |
846 | d_add(dentry, NULL); | ||
844 | return NULL; | 847 | return NULL; |
848 | } | ||
845 | if (IS_ERR(inode)) | 849 | if (IS_ERR(inode)) |
846 | return ERR_CAST(inode); | 850 | return ERR_CAST(inode); |
847 | 851 | ||
@@ -854,7 +858,6 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
854 | 858 | ||
855 | d = d_splice_alias(inode, dentry); | 859 | d = d_splice_alias(inode, dentry); |
856 | if (IS_ERR(d)) { | 860 | if (IS_ERR(d)) { |
857 | iput(inode); | ||
858 | gfs2_glock_dq_uninit(&gh); | 861 | gfs2_glock_dq_uninit(&gh); |
859 | return d; | 862 | return d; |
860 | } | 863 | } |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 2607ff13d486..a346f56c4c6d 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1294,7 +1294,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1294 | int val; | 1294 | int val; |
1295 | 1295 | ||
1296 | if (is_ancestor(root, sdp->sd_master_dir)) | 1296 | if (is_ancestor(root, sdp->sd_master_dir)) |
1297 | seq_printf(s, ",meta"); | 1297 | seq_puts(s, ",meta"); |
1298 | if (args->ar_lockproto[0]) | 1298 | if (args->ar_lockproto[0]) |
1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); | 1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); |
1300 | if (args->ar_locktable[0]) | 1300 | if (args->ar_locktable[0]) |
@@ -1302,13 +1302,13 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1302 | if (args->ar_hostdata[0]) | 1302 | if (args->ar_hostdata[0]) |
1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); | 1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); |
1304 | if (args->ar_spectator) | 1304 | if (args->ar_spectator) |
1305 | seq_printf(s, ",spectator"); | 1305 | seq_puts(s, ",spectator"); |
1306 | if (args->ar_localflocks) | 1306 | if (args->ar_localflocks) |
1307 | seq_printf(s, ",localflocks"); | 1307 | seq_puts(s, ",localflocks"); |
1308 | if (args->ar_debug) | 1308 | if (args->ar_debug) |
1309 | seq_printf(s, ",debug"); | 1309 | seq_puts(s, ",debug"); |
1310 | if (args->ar_posix_acl) | 1310 | if (args->ar_posix_acl) |
1311 | seq_printf(s, ",acl"); | 1311 | seq_puts(s, ",acl"); |
1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { | 1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { |
1313 | char *state; | 1313 | char *state; |
1314 | switch (args->ar_quota) { | 1314 | switch (args->ar_quota) { |
@@ -1328,7 +1328,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1328 | seq_printf(s, ",quota=%s", state); | 1328 | seq_printf(s, ",quota=%s", state); |
1329 | } | 1329 | } |
1330 | if (args->ar_suiddir) | 1330 | if (args->ar_suiddir) |
1331 | seq_printf(s, ",suiddir"); | 1331 | seq_puts(s, ",suiddir"); |
1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { | 1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { |
1333 | char *state; | 1333 | char *state; |
1334 | switch (args->ar_data) { | 1334 | switch (args->ar_data) { |
@@ -1345,7 +1345,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1345 | seq_printf(s, ",data=%s", state); | 1345 | seq_printf(s, ",data=%s", state); |
1346 | } | 1346 | } |
1347 | if (args->ar_discard) | 1347 | if (args->ar_discard) |
1348 | seq_printf(s, ",discard"); | 1348 | seq_puts(s, ",discard"); |
1349 | val = sdp->sd_tune.gt_logd_secs; | 1349 | val = sdp->sd_tune.gt_logd_secs; |
1350 | if (val != 30) | 1350 | if (val != 30) |
1351 | seq_printf(s, ",commit=%d", val); | 1351 | seq_printf(s, ",commit=%d", val); |
@@ -1376,11 +1376,11 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1376 | seq_printf(s, ",errors=%s", state); | 1376 | seq_printf(s, ",errors=%s", state); |
1377 | } | 1377 | } |
1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
1379 | seq_printf(s, ",nobarrier"); | 1379 | seq_puts(s, ",nobarrier"); |
1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) | 1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) |
1381 | seq_printf(s, ",demote_interface_used"); | 1381 | seq_puts(s, ",demote_interface_used"); |
1382 | if (args->ar_rgrplvb) | 1382 | if (args->ar_rgrplvb) |
1383 | seq_printf(s, ",rgrplvb"); | 1383 | seq_puts(s, ",rgrplvb"); |
1384 | return 0; | 1384 | return 0; |
1385 | } | 1385 | } |
1386 | 1386 | ||