Thread (21 messages) 21 messages, 3 authors, 2019-11-28

Re: [PATCH v17 10/13] namei: LOOKUP_{IN_ROOT,BENEATH}: permit limited ".." resolution

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2019-11-25 00:37:46
Also in: linux-alpha, linux-api, linux-arch

On Sun, Nov 17, 2019 at 12:17:10PM +1100, Aleksa Sarai wrote:
+		if (unlikely(nd->flags & LOOKUP_IS_SCOPED)) {
+			/*
+			 * If there was a racing rename or mount along our
+			 * path, then we can't be sure that ".." hasn't jumped
+			 * above nd->root (and so userspace should retry or use
+			 * some fallback).
+			 */
+			if (unlikely(read_seqretry(&mount_lock, nd->m_seq)))
+				return -EAGAIN;
+			if (unlikely(read_seqretry(&rename_lock, nd->r_seq)))
+				return -EAGAIN;
+		}
Looks like excessive barriers to me - it's
	rmb
	check mount_lock.sequence
	rmb
	check rename_lock.sequence
quoted hunk ↗ jump to hunk
@@ -2266,6 +2274,10 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
 	nd->last_type = LAST_ROOT; /* if there are only slashes... */
 	nd->flags = flags | LOOKUP_JUMPED | LOOKUP_PARENT;
 	nd->depth = 0;
+
+	nd->m_seq = read_seqbegin(&mount_lock);
+	nd->r_seq = read_seqbegin(&rename_lock);
Same here, pretty much (fetch/rmb/fetch/rmb)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help