Patch "NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked()" has been added to the 4.1-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked()
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
nfsv4.1-pnfs-fix-borken-function-_same_data_server_addrs_locked.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
6f536936b79bd4b5cea8fb0e5b8b0bce8cd1ea4aMon Sep 17 00:00:00 2001
From: Trond Myklebust <[email protected]>
Date: Thu, 13 Aug 2015 10:59:07 -0400
Subject: NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked()
From: Trond Myklebust <[email protected]>
commit 6f536936b79bd4b5cea8fb0e5b8b0bce8cd1ea4a upstream.
- Switch back to using list_for_each_entry(). Fixes an incorrect test for list NULL termination.
- Do not assume that lists are sorted.
- Finally, consider an existing entry to match if it consists of a subset of the addresses in the new entry.
--- fs/nfs/pnfs_nfs.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
fs/nfs/pnfs_nfs.c +18 -13
@@ -359,26 +359,31 @@ same_sockaddr(struct sockaddr *addr1, streturn false; } +/* +* Checks if 'dsaddrs1' contains a subset of 'dsaddrs2'. If it does, +* declare a match. +*/ static bool _same_data_server_addrs_locked (const struct list_head *dsaddrs1,const struct list_head *dsaddrs2) {struct nfs4_pnfs_ds_addr *da1, *da2; +struct sockaddr *sa1, *sa2; +bool match = false; -/* step through both lists, comparing as we go */ -for (da1 =list_first_entry (dsaddrs1,typeof (*da1), da_node), - da2 =list_first_entry (dsaddrs2,typeof (*da2), da_node); - da1 !=NULL && da2 !=NULL ; - da1 =list_entry (da1->da_node.next,typeof (*da1), da_node), - da2 =list_entry (da2->da_node.next,typeof (*da2), da_node)) { -if (!same_sockaddr ((struct sockaddr *)&da1->da_addr, - (struct sockaddr *)&da2->da_addr)) -return false; +list_for_each_entry (da1, dsaddrs1, da_node) { + sa1 = (struct sockaddr *)&da1->da_addr; + match = false; +list_for_each_entry (da2, dsaddrs2, da_node) { + sa2 = (struct sockaddr *)&da2->da_addr; + match =same_sockaddr (sa1, sa2); +if (match) +break ; + } +if (!match) +break ; } -if (da1 ==NULL && da2 ==NULL ) -return true; - -return false; +return match; }/*
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/nfs-don-t-let-the-ctime-override-attribute-barriers.patch queue-4.1/nfsv4-don-t-set-setattr-for-o_rdonly-o_excl.patch queue-4.1/nfsv4.1-pnfs-fix-borken-function-_same_data_server_addrs_locked.patch queue-4.1/nfsv4-pnfs-ensure-we-don-t-miss-a-file-extension.patch