On Tue, Jun 05, 2012 at 02:16:32PM -0400, Josef Bacik wrote:
> 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
> does just that and have gone through and protected all accesses to
> device->name that aren't under the uuid_mutex with rcu_read_lock().  This
> protects us and I will use it for dealing with removing the device that we
> used to mount the file system in a later patch.  Thanks,
> 
> Signed-off-by: Josef Bacik <jo...@redhat.com>
> ---
>  fs/btrfs/check-integrity.c |   11 ++++-
>  fs/btrfs/disk-io.c         |   14 +++++-
>  fs/btrfs/extent_io.c       |    7 +++-
>  fs/btrfs/ioctl.c           |   14 +++++-
>  fs/btrfs/scrub.c           |   39 ++++++++++++++---
>  fs/btrfs/volumes.c         |  102 
> ++++++++++++++++++++++++++++++++------------
>  fs/btrfs/volumes.h         |    2 +-
>  7 files changed, 147 insertions(+), 42 deletions(-)
> 
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 9cebb1f..9f69855 100644
> --- a/fs/btrfs/check-integrity.c
> +++ 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"

Not included in the patch. Besides, it seems to be a more general API
that should not live inside btrfs directory. While searching for the
rcu-string.h I found

http://lkml.indiana.edu/hypermail/linux/kernel/1001.0/00911.html
"Add rcustring ADT for RCU protected strings v2" @ 2010

doing (probably) the same.


david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to