Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751155Ab3IIIbD (ORCPT ); Mon, 9 Sep 2013 04:31:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:45169 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753Ab3IIIbA (ORCPT ); Mon, 9 Sep 2013 04:31:00 -0400 Date: Mon, 9 Sep 2013 10:30:28 +0200 From: Peter Zijlstra To: Al Viro Cc: Linus Torvalds , Waiman Long , Ingo Molnar , Benjamin Herrenschmidt , Jeff Layton , Miklos Szeredi , Ingo Molnar , Thomas Gleixner , linux-fsdevel , Linux Kernel Mailing List , Steven Rostedt , Andi Kleen , "Chandramouleeswaran, Aswin" , "Norton, Scott J" Subject: Re: [PATCH v7 1/4] spinlock: A new lockref structure for lockless update of refcount Message-ID: <20130909083028.GH31370@twins.programming.kicks-ass.net> References: <5220FD51.2010709@hp.com> <20130830205404.GF13318@ZenIV.linux.org.uk> <20130830214452.GH13318@ZenIV.linux.org.uk> <20130831212355.GN13318@ZenIV.linux.org.uk> <20130831232758.GO13318@ZenIV.linux.org.uk> <20130901001306.GP13318@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130901001306.GP13318@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1369 Lines: 57 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/