linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-afs@lists.infradead.org
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 04/15] afs: Fix missing lock when replacing VL server list
Date: Wed, 15 May 2019 17:26:06 +0100	[thread overview]
Message-ID: <155793756678.31671.3057069610724058972.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <155793753724.31671.7034451837854752319.stgit@warthog.procyon.org.uk>

When afs_update_cell() replaces the cell->vl_servers list, it uses RCU
protocol so that proc is protected, but doesn't take ->vl_servers_lock to
protect afs_start_vl_iteration() (which does actually take a shared lock).

Fix this by making afs_update_cell() take an exclusive lock when replacing
->vl_servers.

Fixes: 0a5143f2f89c ("afs: Implement VL server rotation")
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/cell.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 9de46116c749..9ca075e11239 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -404,12 +404,11 @@ static void afs_update_cell(struct afs_cell *cell)
 		clear_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags);
 		clear_bit(AFS_CELL_FL_NOT_FOUND, &cell->flags);
 
-		/* Exclusion on changing vl_addrs is achieved by a
-		 * non-reentrant work item.
-		 */
+		write_lock(&cell->vl_servers_lock);
 		old = rcu_dereference_protected(cell->vl_servers, true);
 		rcu_assign_pointer(cell->vl_servers, vllist);
 		cell->dns_expiry = expiry;
+		write_unlock(&cell->vl_servers_lock);
 
 		if (old)
 			afs_put_vlserverlist(cell->net, old);


  parent reply	other threads:[~2019-05-15 16:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 16:25 [PATCH 00/15] AFS fixes David Howells
2019-05-15 16:25 ` [PATCH 01/15] afs: Fix key leak in afs_release() and afs_evict_inode() David Howells
2019-05-15 16:25 ` [PATCH 02/15] afs: Fix incorrect error handling in afs_xattr_get_acl() David Howells
2019-05-15 16:26 ` [PATCH 03/15] afs: Fix afs_xattr_get_yfs() to not try freeing an error value David Howells
2019-05-15 16:26 ` David Howells [this message]
2019-05-15 16:26 ` [PATCH 05/15] afs: Fix afs_cell records to always have a VL server list record David Howells
2019-05-15 16:26 ` [PATCH 06/15] dns_resolver: Allow used keys to be invalidated David Howells
2019-05-15 16:26 ` [PATCH 07/15] Add wait_var_event_interruptible() David Howells
2019-05-15 17:30   ` Peter Zijlstra
2019-05-15 16:26 ` [PATCH 08/15] afs: Fix cell DNS lookup David Howells
2019-05-15 16:26 ` [PATCH 09/15] rxrpc: Allow the kernel to mark a call as being non-interruptible David Howells
2019-05-15 16:26 ` [PATCH 10/15] afs: Make some RPC operations non-interruptible David Howells
2019-05-15 16:26 ` [PATCH 11/15] afs: Make dynamic root population wait uninterruptibly for proc_cells_lock David Howells
2019-05-15 16:27 ` [PATCH 12/15] afs: Fix calculation of callback expiry time David Howells
2019-05-15 16:27 ` [PATCH 13/15] afs: Don't invalidate callback if AFS_VNODE_DIR_VALID not set David Howells
2019-05-15 16:27 ` [PATCH 14/15] afs: Fix lock-wait/callback-break double locking David Howells
2019-05-15 16:27 ` [PATCH 15/15] afs: Fix double inc of vnode->cb_break David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155793756678.31671.3057069610724058972.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).