Re: [PATCH v7 1/4] spinlock: A new lockref structure for lockless update of refcount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 01, 2013 at 01:13:06AM +0100, Al Viro wrote:

> +static noinline_for_stack
> +char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_spec spec,
> +		  int depth)
> +{
> +	int i, n = 0;
> +	const char *s;
> +	char *p = buf;
> +	const struct dentry *array[4];
> +	char c;
> +
> +	if (depth < 0) {
> +		depth = 1;
> +		WARN_ON(1);
> +	}
> +	if (depth > 4) {
> +		depth = 4;
> +		WARN_ON(1);
> +	}
> +
> +	rcu_read_lock();
> +	for (i = 0; i < depth; i++) {
> +		struct dentry *p = ACCESS_ONCE(d->d_parent);
> +		array[i] = d;
> +		if (d == p)
> +			break;
> +		d = p;
> +	}
> +	if (!i) {	/* root dentry has a bloody inconvenient name */
> +		i++;
> +		goto do_name;
> +	}
> +	if (i == depth)
> +		goto do_name;
> +	while (i && n != spec.precision) {
> +		if (buf < end)
> +			*buf = '/';
> +		buf++;
> +		n++;
> +do_name:
> +		s = ACCESS_ONCE(array[--i]->d_name.name);
> +		while (n != spec.precision && (c = *s++) != '\0') {
> +			if (buf < end)
> +				*buf = c;
> +			buf++;
> +			n++;
> +		}
> +	}
> +	rcu_read_unlock();

Should one or both of those ACCESS_ONCE()s be an rcu_dereference()?
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux