diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2014-01-16 05:31:13 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-01-16 05:31:13 -0500 |
commit | ac3beb6a5de048e7c0676f630ad2048a7b37b305 (patch) | |
tree | 4072e122736153623d1631fceb2abe7704aa4b54 | |
parent | 1e3d36206bd6dfa34c85b073faba3d94ee6aba79 (diff) |
GFS2: Don't use ENOBUFS when ENOMEM is the correct error code
Al Viro has tactfully pointed out that we are using the incorrect
error code in some cases. This patch fixes that, and also removes
the (unused) return value for glock dumping.
> * gfs2_iget() - ENOBUFS instead of ENOMEM. ENOBUFS is
> "No buffer space available (POSIX.1 (XSI STREAMS option))" and since
> we don't support STREAMS it's probably fair game, but... what the hell?
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
-rw-r--r-- | fs/gfs2/glock.c | 29 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 2 | ||||
-rw-r--r-- | fs/gfs2/glops.c | 6 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 2 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 2 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 2 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 5 | ||||
-rw-r--r-- | fs/gfs2/rgrp.h | 2 |
8 files changed, 19 insertions, 31 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 6f7a47c05259..ca0be6c69a26 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1552,13 +1552,11 @@ void gfs2_glock_thaw(struct gfs2_sbd *sdp) | |||
1552 | glock_hash_walk(thaw_glock, sdp); | 1552 | glock_hash_walk(thaw_glock, sdp); |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | static int dump_glock(struct seq_file *seq, struct gfs2_glock *gl) | 1555 | static void dump_glock(struct seq_file *seq, struct gfs2_glock *gl) |
1556 | { | 1556 | { |
1557 | int ret; | ||
1558 | spin_lock(&gl->gl_spin); | 1557 | spin_lock(&gl->gl_spin); |
1559 | ret = gfs2_dump_glock(seq, gl); | 1558 | gfs2_dump_glock(seq, gl); |
1560 | spin_unlock(&gl->gl_spin); | 1559 | spin_unlock(&gl->gl_spin); |
1561 | return ret; | ||
1562 | } | 1560 | } |
1563 | 1561 | ||
1564 | static void dump_glock_func(struct gfs2_glock *gl) | 1562 | static void dump_glock_func(struct gfs2_glock *gl) |
@@ -1647,10 +1645,9 @@ static const char *hflags2str(char *buf, unsigned flags, unsigned long iflags) | |||
1647 | * @seq: the seq_file struct | 1645 | * @seq: the seq_file struct |
1648 | * @gh: the glock holder | 1646 | * @gh: the glock holder |
1649 | * | 1647 | * |
1650 | * Returns: 0 on success, -ENOBUFS when we run out of space | ||
1651 | */ | 1648 | */ |
1652 | 1649 | ||
1653 | static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) | 1650 | static void dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) |
1654 | { | 1651 | { |
1655 | struct task_struct *gh_owner = NULL; | 1652 | struct task_struct *gh_owner = NULL; |
1656 | char flags_buf[32]; | 1653 | char flags_buf[32]; |
@@ -1666,7 +1663,6 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) | |||
1666 | gh_owner ? gh_owner->comm : "(ended)", | 1663 | gh_owner ? gh_owner->comm : "(ended)", |
1667 | (void *)gh->gh_ip); | 1664 | (void *)gh->gh_ip); |
1668 | rcu_read_unlock(); | 1665 | rcu_read_unlock(); |
1669 | return 0; | ||
1670 | } | 1666 | } |
1671 | 1667 | ||
1672 | static const char *gflags2str(char *buf, const struct gfs2_glock *gl) | 1668 | static const char *gflags2str(char *buf, const struct gfs2_glock *gl) |
@@ -1721,16 +1717,14 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl) | |||
1721 | * example. The field's are n = number (id of the object), f = flags, | 1717 | * example. The field's are n = number (id of the object), f = flags, |
1722 | * t = type, s = state, r = refcount, e = error, p = pid. | 1718 | * t = type, s = state, r = refcount, e = error, p = pid. |
1723 | * | 1719 | * |
1724 | * Returns: 0 on success, -ENOBUFS when we run out of space | ||
1725 | */ | 1720 | */ |
1726 | 1721 | ||
1727 | int gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) | 1722 | void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) |
1728 | { | 1723 | { |
1729 | const struct gfs2_glock_operations *glops = gl->gl_ops; | 1724 | const struct gfs2_glock_operations *glops = gl->gl_ops; |
1730 | unsigned long long dtime; | 1725 | unsigned long long dtime; |
1731 | const struct gfs2_holder *gh; | 1726 | const struct gfs2_holder *gh; |
1732 | char gflags_buf[32]; | 1727 | char gflags_buf[32]; |
1733 | int error = 0; | ||
1734 | 1728 | ||
1735 | dtime = jiffies - gl->gl_demote_time; | 1729 | dtime = jiffies - gl->gl_demote_time; |
1736 | dtime *= 1000000/HZ; /* demote time in uSec */ | 1730 | dtime *= 1000000/HZ; /* demote time in uSec */ |
@@ -1747,15 +1741,11 @@ int gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl) | |||
1747 | atomic_read(&gl->gl_revokes), | 1741 | atomic_read(&gl->gl_revokes), |
1748 | (int)gl->gl_lockref.count, gl->gl_hold_time); | 1742 | (int)gl->gl_lockref.count, gl->gl_hold_time); |
1749 | 1743 | ||
1750 | list_for_each_entry(gh, &gl->gl_holders, gh_list) { | 1744 | list_for_each_entry(gh, &gl->gl_holders, gh_list) |
1751 | error = dump_holder(seq, gh); | 1745 | dump_holder(seq, gh); |
1752 | if (error) | 1746 | |
1753 | goto out; | ||
1754 | } | ||
1755 | if (gl->gl_state != LM_ST_UNLOCKED && glops->go_dump) | 1747 | if (gl->gl_state != LM_ST_UNLOCKED && glops->go_dump) |
1756 | error = glops->go_dump(seq, gl); | 1748 | glops->go_dump(seq, gl); |
1757 | out: | ||
1758 | return error; | ||
1759 | } | 1749 | } |
1760 | 1750 | ||
1761 | static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr) | 1751 | static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr) |
@@ -1953,7 +1943,8 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr) | |||
1953 | 1943 | ||
1954 | static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) | 1944 | static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) |
1955 | { | 1945 | { |
1956 | return dump_glock(seq, iter_ptr); | 1946 | dump_glock(seq, iter_ptr); |
1947 | return 0; | ||
1957 | } | 1948 | } |
1958 | 1949 | ||
1959 | static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) | 1950 | static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) |
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 6647d77366ba..32572f71f027 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -199,7 +199,7 @@ extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number, | |||
199 | struct gfs2_holder *gh); | 199 | struct gfs2_holder *gh); |
200 | extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); | 200 | extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); |
201 | extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs); | 201 | extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs); |
202 | extern int gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl); | 202 | extern void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl); |
203 | #define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0) | 203 | #define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0) |
204 | extern __printf(2, 3) | 204 | extern __printf(2, 3) |
205 | void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...); | 205 | void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...); |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index b792dbcc83f6..3bf0631b5d56 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -437,21 +437,19 @@ static int inode_go_lock(struct gfs2_holder *gh) | |||
437 | * @seq: The iterator | 437 | * @seq: The iterator |
438 | * @ip: the inode | 438 | * @ip: the inode |
439 | * | 439 | * |
440 | * Returns: 0 on success, -ENOBUFS when we run out of space | ||
441 | */ | 440 | */ |
442 | 441 | ||
443 | static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | 442 | static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) |
444 | { | 443 | { |
445 | const struct gfs2_inode *ip = gl->gl_object; | 444 | const struct gfs2_inode *ip = gl->gl_object; |
446 | if (ip == NULL) | 445 | if (ip == NULL) |
447 | return 0; | 446 | return; |
448 | gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu\n", | 447 | gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu\n", |
449 | (unsigned long long)ip->i_no_formal_ino, | 448 | (unsigned long long)ip->i_no_formal_ino, |
450 | (unsigned long long)ip->i_no_addr, | 449 | (unsigned long long)ip->i_no_addr, |
451 | IF2DT(ip->i_inode.i_mode), ip->i_flags, | 450 | IF2DT(ip->i_inode.i_mode), ip->i_flags, |
452 | (unsigned int)ip->i_diskflags, | 451 | (unsigned int)ip->i_diskflags, |
453 | (unsigned long long)i_size_read(&ip->i_inode)); | 452 | (unsigned long long)i_size_read(&ip->i_inode)); |
454 | return 0; | ||
455 | } | 453 | } |
456 | 454 | ||
457 | /** | 455 | /** |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 8c64e268b7ef..cf0e34400f71 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -218,7 +218,7 @@ struct gfs2_glock_operations { | |||
218 | int (*go_demote_ok) (const struct gfs2_glock *gl); | 218 | int (*go_demote_ok) (const struct gfs2_glock *gl); |
219 | int (*go_lock) (struct gfs2_holder *gh); | 219 | int (*go_lock) (struct gfs2_holder *gh); |
220 | void (*go_unlock) (struct gfs2_holder *gh); | 220 | void (*go_unlock) (struct gfs2_holder *gh); |
221 | int (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl); | 221 | void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl); |
222 | void (*go_callback)(struct gfs2_glock *gl, bool remote); | 222 | void (*go_callback)(struct gfs2_glock *gl, bool remote); |
223 | const int go_type; | 223 | const int go_type; |
224 | const unsigned long go_flags; | 224 | const unsigned long go_flags; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 51cf10df83e4..b8956f24e3d3 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -149,7 +149,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, | |||
149 | ip = GFS2_I(inode); | 149 | ip = GFS2_I(inode); |
150 | 150 | ||
151 | if (!inode) | 151 | if (!inode) |
152 | return ERR_PTR(-ENOBUFS); | 152 | return ERR_PTR(-ENOMEM); |
153 | 153 | ||
154 | if (inode->i_state & I_NEW) { | 154 | if (inode->i_state & I_NEW) { |
155 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 155 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 06a66c9624e6..1e712b566d76 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -231,7 +231,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) | |||
231 | 231 | ||
232 | page = alloc_page(GFP_NOFS); | 232 | page = alloc_page(GFP_NOFS); |
233 | if (unlikely(!page)) | 233 | if (unlikely(!page)) |
234 | return -ENOBUFS; | 234 | return -ENOMEM; |
235 | 235 | ||
236 | ClearPageUptodate(page); | 236 | ClearPageUptodate(page); |
237 | ClearPageDirty(page); | 237 | ClearPageDirty(page); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 183cf0f0052d..e14e8877db96 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -2120,14 +2120,14 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
2120 | * | 2120 | * |
2121 | */ | 2121 | */ |
2122 | 2122 | ||
2123 | int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl) | 2123 | void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl) |
2124 | { | 2124 | { |
2125 | struct gfs2_rgrpd *rgd = gl->gl_object; | 2125 | struct gfs2_rgrpd *rgd = gl->gl_object; |
2126 | struct gfs2_blkreserv *trs; | 2126 | struct gfs2_blkreserv *trs; |
2127 | const struct rb_node *n; | 2127 | const struct rb_node *n; |
2128 | 2128 | ||
2129 | if (rgd == NULL) | 2129 | if (rgd == NULL) |
2130 | return 0; | 2130 | return; |
2131 | gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u r:%u e:%u\n", | 2131 | gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u r:%u e:%u\n", |
2132 | (unsigned long long)rgd->rd_addr, rgd->rd_flags, | 2132 | (unsigned long long)rgd->rd_addr, rgd->rd_flags, |
2133 | rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes, | 2133 | rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes, |
@@ -2138,7 +2138,6 @@ int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
2138 | dump_rs(seq, trs); | 2138 | dump_rs(seq, trs); |
2139 | } | 2139 | } |
2140 | spin_unlock(&rgd->rd_rsspin); | 2140 | spin_unlock(&rgd->rd_rsspin); |
2141 | return 0; | ||
2142 | } | 2141 | } |
2143 | 2142 | ||
2144 | static void gfs2_rgrp_error(struct gfs2_rgrpd *rgd) | 2143 | static void gfs2_rgrp_error(struct gfs2_rgrpd *rgd) |
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index 3a10d2ffbbe7..463ab2e95d1c 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h | |||
@@ -68,7 +68,7 @@ extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, | |||
68 | extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state); | 68 | extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state); |
69 | extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); | 69 | extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist); |
70 | extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); | 70 | extern u64 gfs2_ri_total(struct gfs2_sbd *sdp); |
71 | extern int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl); | 71 | extern void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl); |
72 | extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, | 72 | extern int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, |
73 | struct buffer_head *bh, | 73 | struct buffer_head *bh, |
74 | const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed); | 74 | const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed); |