Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-14 Thread David Sterba
On Wed, Jun 13, 2012 at 09:51:03AM -0400, Josef Bacik wrote: > On Wed, Jun 13, 2012 at 03:49:07PM +0200, Stefan Behrens wrote: > > The last sentence of chapter 2 of Documentation/CodingStyle is quite > > unambiguous. Here is the full quote of that chapter: > > > > Chapter 2: Breaki

Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-13 Thread Josef Bacik
On Wed, Jun 13, 2012 at 03:49:07PM +0200, Stefan Behrens wrote: > On Wed, 13 Jun 2012 09:14:27 -0400, Josef Bacik wrote: > > On Wed, Jun 13, 2012 at 12:35:26AM +0200, David Sterba wrote: > >> On Tue, Jun 12, 2012 at 03:50:41PM -0400, Josef Bacik wrote: > >>> @@ -4694,8 +4716,11 @@ int btrfs_init_de

Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-13 Thread Stefan Behrens
On Wed, 13 Jun 2012 09:14:27 -0400, Josef Bacik wrote: > On Wed, Jun 13, 2012 at 12:35:26AM +0200, David Sterba wrote: >> On Tue, Jun 12, 2012 at 03:50:41PM -0400, Josef Bacik wrote: >>> @@ -4694,8 +4716,11 @@ int btrfs_init_dev_stats(struct btrfs_fs_info >>> *fs_info) >>> key.offset =

Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-13 Thread Josef Bacik
On Wed, Jun 13, 2012 at 12:35:26AM +0200, David Sterba wrote: > On Tue, Jun 12, 2012 at 03:50:41PM -0400, Josef Bacik wrote: > > +++ b/fs/btrfs/check-integrity.c > > @@ -93,6 +93,7 @@ > > #include "print-tree.h" > > #include "locking.h" > > #include "check-integrity.h" > > +#include "rcu-string.

Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-13 Thread Stefan Behrens
On Wed, 13 Jun 2012 00:35:26 +0200, David Sterba wrote: > On Tue, Jun 12, 2012 at 03:50:41PM -0400, Josef Bacik wrote: >> +++ b/fs/btrfs/check-integrity.c >> @@ -93,6 +93,7 @@ >> #include "print-tree.h" >> #include "locking.h" >> #include "check-integrity.h" >> +#include "rcu-string.h" >> >>

Re: [PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-12 Thread David Sterba
On Tue, Jun 12, 2012 at 03:50:41PM -0400, Josef Bacik wrote: > +++ b/fs/btrfs/check-integrity.c > @@ -93,6 +93,7 @@ > #include "print-tree.h" > #include "locking.h" > #include "check-integrity.h" > +#include "rcu-string.h" > > #define BTRFSIC_BLOCK_HASHTABLE_SIZE 0x1 > #define BTRFSIC_BL

[PATCH 1/2] Btrfs: use rcu to protect device->name V2

2012-06-12 Thread Josef Bacik
Al pointed out that we can just toss out the old name on a device and add a new one arbitrarily, so anybody who uses device->name in printk could possibly use free'd memory. Instead of adding locking around all of this he suggested doing it with RCU, so I've introduced a struct rcu_string that doe