* Re: [PATCH 0/11] btrfs: misc fixes and cleanups
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
@ 2013-01-31 0:15 ` Zach Brown
2013-01-31 0:54 ` [PATCH 01/11] btrfs: remove unused fd in btrfs_ioctl_send() Eric Sandeen
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Zach Brown @ 2013-01-31 0:15 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-btrfs
On Wed, Jan 30, 2013 at 06:54:51PM -0600, Eric Sandeen wrote:
> A handful of fixes from looking at Coverity static checker
> results, and the surrounding code. Of varying severity,
> but all worthwhile I hope.
>
> Full disclosure: compile-tested only, but nothing too crazy
> in here I think.
Yeah, this all seems pretty reasonable to me.
Signed-off-by: Zach Brown <zab@redhat.com>
- z
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 0/11] btrfs: misc fixes and cleanups
@ 2013-01-31 0:54 Eric Sandeen
2013-01-31 0:15 ` Zach Brown
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs
A handful of fixes from looking at Coverity static checker
results, and the surrounding code. Of varying severity,
but all worthwhile I hope.
Full disclosure: compile-tested only, but nothing too crazy
in here I think.
Thanks,
-Eric
[PATCH 01/11] btrfs: remove unused fd in btrfs_ioctl_send()
[PATCH 02/11] btrfs: list_entry can't return NULL
[PATCH 03/11] btrfs: remove unused fs_info from btrfs_decode_error()
[PATCH 04/11] btrfs: handle null fs_info in btrfs_panic()
[PATCH 05/11] btrfs: annotate intentional switch case fallthroughs
[PATCH 06/11] btrfs: add missing break in btrfs_print_leaf()
[PATCH 07/11] btrfs: fix varargs in __btrfs_std_error
[PATCH 08/11] btrfs: remove unused "item" in btrfs_insert_delayed_item()
[PATCH 09/11] btrfs: remove unnecessary DEFINE_WAIT() declarations
[PATCH 10/11] btrfs: ensure we don't overrun devices_info[] in __btrfs_alloc_chunk
[PATCH 11/11] btrfs: don't try to notify udev about missing devices
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 01/11] btrfs: remove unused fd in btrfs_ioctl_send()
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
2013-01-31 0:15 ` Zach Brown
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 02/11] btrfs: list_entry can't return NULL Eric Sandeen
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
All we do is set it to NULL and test it :)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/send.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 321b7fb..614da0d 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -4536,7 +4536,6 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
struct btrfs_fs_info *fs_info;
struct btrfs_ioctl_send_args *arg = NULL;
struct btrfs_key key;
- struct file *filp = NULL;
struct send_ctx *sctx = NULL;
u32 i;
u64 *clone_sources_tmp = NULL;
@@ -4673,8 +4672,6 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
goto out;
out:
- if (filp)
- fput(filp);
kfree(arg);
vfree(clone_sources_tmp);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 02/11] btrfs: list_entry can't return NULL
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
2013-01-31 0:15 ` Zach Brown
2013-01-31 0:54 ` [PATCH 01/11] btrfs: remove unused fd in btrfs_ioctl_send() Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 03/11] btrfs: remove unused fs_info from btrfs_decode_error() Eric Sandeen
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
No need to test the result, we can't get a
null pointer from list_entry()
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/disk-io.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a8f652d..d89da40 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3823,8 +3823,6 @@ int btrfs_cleanup_transaction(struct btrfs_root *root)
while (!list_empty(&list)) {
t = list_entry(list.next, struct btrfs_transaction, list);
- if (!t)
- break;
btrfs_destroy_ordered_operations(root);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 03/11] btrfs: remove unused fs_info from btrfs_decode_error()
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (2 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 02/11] btrfs: list_entry can't return NULL Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 04/11] btrfs: handle null fs_info in btrfs_panic() Eric Sandeen
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/super.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d8982e9..e933a5f 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -63,8 +63,7 @@
static const struct super_operations btrfs_super_ops;
static struct file_system_type btrfs_fs_type;
-static const char *btrfs_decode_error(struct btrfs_fs_info *fs_info, int errno,
- char nbuf[16])
+static const char *btrfs_decode_error(int errno, char nbuf[16])
{
char *errstr = NULL;
@@ -152,7 +151,7 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
if (errno == -EROFS && (sb->s_flags & MS_RDONLY))
return;
- errstr = btrfs_decode_error(fs_info, errno, nbuf);
+ errstr = btrfs_decode_error(errno, nbuf);
if (fmt) {
struct va_format vaf = {
.fmt = fmt,
@@ -261,7 +260,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
char nbuf[16];
const char *errstr;
- errstr = btrfs_decode_error(root->fs_info, errno, nbuf);
+ errstr = btrfs_decode_error(errno, nbuf);
btrfs_printk(root->fs_info,
"%s:%d: Aborting unused transaction(%s).\n",
function, line, errstr);
@@ -289,7 +288,7 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
va_start(args, fmt);
vaf.va = &args;
- errstr = btrfs_decode_error(fs_info, errno, nbuf);
+ errstr = btrfs_decode_error(errno, nbuf);
if (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)
panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n",
s_id, function, line, &vaf, errstr);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 04/11] btrfs: handle null fs_info in btrfs_panic()
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (3 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 03/11] btrfs: remove unused fs_info from btrfs_decode_error() Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 05/11] btrfs: annotate intentional switch case fallthroughs Eric Sandeen
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
At least backref_tree_panic() can apparently pass
in a null fs_info, so handle that in __btrfs_panic
to get the message out on the console.
The btrfs_panic macro also uses fs_info, but that's
largely pointless; it's testing to see if
BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is not set.
But if it *were* set, __btrfs_panic() would have,
well, paniced and we wouldn't be here, testing it!
So just BUG() at this point.
And since we only use fs_info once now, just use it
directly.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/ctree.h | 9 ++++++---
fs/btrfs/super.c | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 547b7b0..57121fc 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3620,11 +3620,14 @@ __printf(5, 6)
void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
unsigned int line, int errno, const char *fmt, ...);
+/*
+ * If BTRFS_MOUNT_PANIC_ON_FATAL_ERROR is in mount_opt, __btrfs_panic
+ * will panic(). Otherwise we BUG() here.
+ */
#define btrfs_panic(fs_info, errno, fmt, args...) \
do { \
- struct btrfs_fs_info *_i = (fs_info); \
- __btrfs_panic(_i, __func__, __LINE__, errno, fmt, ##args); \
- BUG_ON(!(_i->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)); \
+ __btrfs_panic(fs_info, __func__, __LINE__, errno, fmt, ##args); \
+ BUG(); \
} while (0)
/* acl.c */
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index e933a5f..d5e7e18 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -289,7 +289,7 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
vaf.va = &args;
errstr = btrfs_decode_error(errno, nbuf);
- if (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)
+ if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR))
panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n",
s_id, function, line, &vaf, errstr);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 05/11] btrfs: annotate intentional switch case fallthroughs
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (4 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 04/11] btrfs: handle null fs_info in btrfs_panic() Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 06/11] btrfs: add missing break in btrfs_print_leaf() Eric Sandeen
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
This keeps static checkers happy.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/ctree.c | 1 +
fs/btrfs/super.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index eea5da7..ac4a424 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1138,6 +1138,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
switch (tm->op) {
case MOD_LOG_KEY_REMOVE_WHILE_FREEING:
BUG_ON(tm->slot < n);
+ /* Fallthrough */
case MOD_LOG_KEY_REMOVE_WHILE_MOVING:
case MOD_LOG_KEY_REMOVE:
btrfs_set_node_key(eb, &tm->key, tm->slot);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index d5e7e18..1dd2d86 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -437,6 +437,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
case Opt_compress_force:
case Opt_compress_force_type:
compress_force = true;
+ /* Fallthrough */
case Opt_compress:
case Opt_compress_type:
if (token == Opt_compress ||
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 06/11] btrfs: add missing break in btrfs_print_leaf()
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (5 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 05/11] btrfs: annotate intentional switch case fallthroughs Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 07/11] btrfs: fix varargs in __btrfs_std_error Eric Sandeen
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
I don't think that BTRFS_DEV_EXTENT_KEY is supposed
to fall through to BTRFS_DEV_STATS_KEY ...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/print-tree.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 50d95fd..920957e 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -294,6 +294,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
btrfs_dev_extent_chunk_offset(l, dev_extent),
(unsigned long long)
btrfs_dev_extent_length(l, dev_extent));
+ break;
case BTRFS_DEV_STATS_KEY:
printk(KERN_INFO "\t\tdevice stats\n");
break;
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 07/11] btrfs: fix varargs in __btrfs_std_error
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (6 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 06/11] btrfs: add missing break in btrfs_print_leaf() Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:54 ` [PATCH 08/11] btrfs: remove unused "item" in btrfs_insert_delayed_item() Eric Sandeen
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
__btrfs_std_error didn't always properly call va_end,
and might call va_start even if fmt was NULL.
Move all the varargs handling into the block where we
have fmt.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/super.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 1dd2d86..fe3c799 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -141,8 +141,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
struct super_block *sb = fs_info->sb;
char nbuf[16];
const char *errstr;
- va_list args;
- va_start(args, fmt);
/*
* Special case: if the error is EROFS, and we're already
@@ -153,13 +151,16 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
errstr = btrfs_decode_error(errno, nbuf);
if (fmt) {
- struct va_format vaf = {
- .fmt = fmt,
- .va = &args,
- };
+ struct va_format vaf;
+ va_list args;
+
+ va_start(args, fmt);
+ vaf.fmt = fmt;
+ vaf.va = &args;
printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s (%pV)\n",
sb->s_id, function, line, errstr, &vaf);
+ va_end(args);
} else {
printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s\n",
sb->s_id, function, line, errstr);
@@ -170,7 +171,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
save_error_info(fs_info);
btrfs_handle_error(fs_info);
}
- va_end(args);
}
static const char * const logtypes[] = {
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 08/11] btrfs: remove unused "item" in btrfs_insert_delayed_item()
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (7 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 07/11] btrfs: fix varargs in __btrfs_std_error Eric Sandeen
@ 2013-01-31 0:54 ` Eric Sandeen
2013-01-31 0:55 ` [PATCH 09/11] btrfs: remove unnecessary DEFINE_WAIT() declarations Eric Sandeen
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
"item" was set but never used in this function.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/delayed-inode.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 3483603..092c680 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -875,7 +875,6 @@ static int btrfs_insert_delayed_item(struct btrfs_trans_handle *trans,
struct btrfs_delayed_item *delayed_item)
{
struct extent_buffer *leaf;
- struct btrfs_item *item;
char *ptr;
int ret;
@@ -886,7 +885,6 @@ static int btrfs_insert_delayed_item(struct btrfs_trans_handle *trans,
leaf = path->nodes[0];
- item = btrfs_item_nr(leaf, path->slots[0]);
ptr = btrfs_item_ptr(leaf, path->slots[0], char);
write_extent_buffer(leaf, delayed_item->data, (unsigned long)ptr,
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 09/11] btrfs: remove unnecessary DEFINE_WAIT() declarations
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (8 preceding siblings ...)
2013-01-31 0:54 ` [PATCH 08/11] btrfs: remove unused "item" in btrfs_insert_delayed_item() Eric Sandeen
@ 2013-01-31 0:55 ` Eric Sandeen
2013-01-31 0:55 ` [PATCH 10/11] btrfs: ensure we don't overrun devices_info[] in __btrfs_alloc_chunk Eric Sandeen
2013-01-31 0:55 ` [PATCH 11/11] btrfs: don't try to notify udev about missing devices Eric Sandeen
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:55 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
No point in DEFINE_WAIT(wait) if it's not used!
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/extent-tree.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a8b8adc..0bb3424 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5478,7 +5478,6 @@ wait_block_group_cache_progress(struct btrfs_block_group_cache *cache,
u64 num_bytes)
{
struct btrfs_caching_control *caching_ctl;
- DEFINE_WAIT(wait);
caching_ctl = get_caching_control(cache);
if (!caching_ctl)
@@ -5495,7 +5494,6 @@ static noinline int
wait_block_group_cache_done(struct btrfs_block_group_cache *cache)
{
struct btrfs_caching_control *caching_ctl;
- DEFINE_WAIT(wait);
caching_ctl = get_caching_control(cache);
if (!caching_ctl)
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 10/11] btrfs: ensure we don't overrun devices_info[] in __btrfs_alloc_chunk
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (9 preceding siblings ...)
2013-01-31 0:55 ` [PATCH 09/11] btrfs: remove unnecessary DEFINE_WAIT() declarations Eric Sandeen
@ 2013-01-31 0:55 ` Eric Sandeen
2013-01-31 0:55 ` [PATCH 11/11] btrfs: don't try to notify udev about missing devices Eric Sandeen
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:55 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
WARN_ON isn't enough, we need to stop the loop if for any reason
we would overrun the devices_info array.
I tried to track down the connection between the length of
the alloc_devices list and the rw_devices counter but
it wasn't immediately obvious, so be defensive about it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/volumes.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 15f6efd..09c63ac 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3630,12 +3630,16 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if (max_avail < BTRFS_STRIPE_LEN * dev_stripes)
continue;
+ if (ndevs == fs_devices->rw_devices) {
+ WARN(1, "%s: found more than %llu devices\n",
+ __func__, fs_devices->rw_devices);
+ break;
+ }
devices_info[ndevs].dev_offset = dev_offset;
devices_info[ndevs].max_avail = max_avail;
devices_info[ndevs].total_avail = total_avail;
devices_info[ndevs].dev = device;
++ndevs;
- WARN_ON(ndevs > fs_devices->rw_devices);
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 11/11] btrfs: don't try to notify udev about missing devices
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
` (10 preceding siblings ...)
2013-01-31 0:55 ` [PATCH 10/11] btrfs: ensure we don't overrun devices_info[] in __btrfs_alloc_chunk Eric Sandeen
@ 2013-01-31 0:55 ` Eric Sandeen
11 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2013-01-31 0:55 UTC (permalink / raw)
To: linux-btrfs; +Cc: Eric Sandeen
If we remove a missing device, bdev is null, and if we
send that off to btrfs_kobject_uevent we'll panic.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
fs/btrfs/volumes.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 09c63ac..bdd6962 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1556,7 +1556,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
ret = 0;
/* Notify udev that device has changed */
- btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
+ if (bdev)
+ btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
error_brelse:
brelse(bh);
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-01-31 0:15 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31 0:54 [PATCH 0/11] btrfs: misc fixes and cleanups Eric Sandeen
2013-01-31 0:15 ` Zach Brown
2013-01-31 0:54 ` [PATCH 01/11] btrfs: remove unused fd in btrfs_ioctl_send() Eric Sandeen
2013-01-31 0:54 ` [PATCH 02/11] btrfs: list_entry can't return NULL Eric Sandeen
2013-01-31 0:54 ` [PATCH 03/11] btrfs: remove unused fs_info from btrfs_decode_error() Eric Sandeen
2013-01-31 0:54 ` [PATCH 04/11] btrfs: handle null fs_info in btrfs_panic() Eric Sandeen
2013-01-31 0:54 ` [PATCH 05/11] btrfs: annotate intentional switch case fallthroughs Eric Sandeen
2013-01-31 0:54 ` [PATCH 06/11] btrfs: add missing break in btrfs_print_leaf() Eric Sandeen
2013-01-31 0:54 ` [PATCH 07/11] btrfs: fix varargs in __btrfs_std_error Eric Sandeen
2013-01-31 0:54 ` [PATCH 08/11] btrfs: remove unused "item" in btrfs_insert_delayed_item() Eric Sandeen
2013-01-31 0:55 ` [PATCH 09/11] btrfs: remove unnecessary DEFINE_WAIT() declarations Eric Sandeen
2013-01-31 0:55 ` [PATCH 10/11] btrfs: ensure we don't overrun devices_info[] in __btrfs_alloc_chunk Eric Sandeen
2013-01-31 0:55 ` [PATCH 11/11] btrfs: don't try to notify udev about missing devices Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).