* [PATCH 1/4] NFS: Fix attribute updates
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-09 19:00 ` [PATCH 4/4] NFS: fix nfs_parse_ip_address() corner case Trond Myklebust
@ 2008-10-09 19:00 ` Trond Myklebust
2008-10-09 19:00 ` [PATCH 3/4] NFS: Cleanup nfs_set_port Trond Myklebust
2008-10-09 19:00 ` [PATCH 2/4] NFS: Remove checks for scope id's in v6 addresses in the fs-locations code Trond Myklebust
3 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2008-10-09 19:00 UTC (permalink / raw)
To: linux-nfs
This fixes a regression seen when running the Connectathon testsuite
against an ext3 filesystem. The reason was that the inode was constantly
being marked as 'just updated' by the jiffy wraparound test.
This again meant that newer GETATTR calls were failing to pass the
nfs_inode_attrs_need_update() test unless the changes caused a ctime update
on the server, since they were perceived as having been started before the
latest inode update.
Given that nfs_inode_attrs_need_update() already checks for wraparound
of nfsi->last_updated, we can drop the buggy "protection" in
nfs_update_inode().
Also make a slight micro-optimisation of nfs_inode_attrs_need_update(): we
are more often going to see time_after(fattr->time_start, nfsi->last_updated)
be true, rather than seeing an update of ctime/size, so put that test
first to ensure that we optimise away the ctime/size tests.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/inode.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index e25009f..6554281 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -933,10 +933,10 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n
{
const struct nfs_inode *nfsi = NFS_I(inode);
- return nfs_ctime_need_update(inode, fattr) ||
- nfs_size_need_update(inode, fattr) ||
- time_after(fattr->time_start, nfsi->last_updated) ||
- time_after(nfsi->last_updated, jiffies);
+ return time_after(fattr->time_start, nfsi->last_updated) ||
+ nfs_ctime_need_update(inode, fattr) ||
+ nfs_size_need_update(inode, fattr) ||
+ time_after(nfsi->last_updated, jiffies);
}
static int nfs_refresh_inode_locked(struct inode *inode, struct nfs_fattr *fattr)
@@ -1167,11 +1167,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
nfsi->attrtimeo = NFS_MAXATTRTIMEO(inode);
nfsi->attrtimeo_timestamp = now;
}
- /*
- * Avoid jiffy wraparound issues with nfsi->last_updated
- */
- if (!time_in_range(nfsi->last_updated, nfsi->read_cache_jiffies, now))
- nfsi->last_updated = nfsi->read_cache_jiffies;
}
invalid &= ~NFS_INO_INVALID_ATTR;
/* Don't invalidate the data if we were to blame */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 0/4] Fixups agains the nfs 'devel' branch
@ 2008-10-09 19:00 Trond Myklebust
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2008-10-09 19:00 UTC (permalink / raw)
To: linux-nfs
The following series fixes a Connectathon testsuite regression, as
well as updating a couple of old patches from Bruce and Chuck.
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@netapp.com
www.netapp.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] NFS: fix nfs_parse_ip_address() corner case
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2008-10-09 19:00 ` Trond Myklebust
2008-10-09 19:00 ` [PATCH 1/4] NFS: Fix attribute updates Trond Myklebust
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2008-10-09 19:00 UTC (permalink / raw)
To: linux-nfs; +Cc: Chuck Lever, J. Bruce Fields
From: Chuck Lever <chuck.lever@oracle.com>
Bruce observed that nfs_parse_ip_address() will successfully parse an
IPv6 address that looks like this:
"::1%"
A scope delimiter is present, but there is no scope ID following it.
This is harmless, as it would simply set the scope ID to zero. However,
in some cases we would like to flag this as an improperly formed
address.
We are now also careful to reject addresses where garbage follows the
address (up to the length of the string), instead of ignoring the
non-address characters; and where the scope ID is nonsense (not a valid
device name, but also not numeric). Before, both of these cases would
result in a harmless zero scope ID.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/super.c | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 6b447f5..27c7c3d 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -719,17 +719,21 @@ static void nfs_parse_ipv4_address(char *string, size_t str_len,
#define IPV6_SCOPE_DELIMITER '%'
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
- const char *delim,
- struct sockaddr_in6 *sin6)
+static int nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
+ const char *delim,
+ struct sockaddr_in6 *sin6)
{
char *p;
size_t len;
- if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
- return ;
+ if ((string + str_len) == delim)
+ return 1;
+
if (*delim != IPV6_SCOPE_DELIMITER)
- return;
+ return 0;
+
+ if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
+ return 0;
len = (string + str_len) - delim - 1;
p = kstrndup(delim + 1, len, GFP_KERNEL);
@@ -742,14 +746,20 @@ static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
scope_id = dev->ifindex;
dev_put(dev);
} else {
- /* scope_id is set to zero on error */
- strict_strtoul(p, 10, &scope_id);
+ if (strict_strtoul(p, 10, &scope_id) == 0) {
+ kfree(p);
+ return 0;
+ }
}
kfree(p);
+
sin6->sin6_scope_id = scope_id;
dfprintk(MOUNT, "NFS: IPv6 scope ID = %lu\n", scope_id);
+ return 1;
}
+
+ return 0;
}
static void nfs_parse_ipv6_address(char *string, size_t str_len,
@@ -765,9 +775,11 @@ static void nfs_parse_ipv6_address(char *string, size_t str_len,
sin6->sin6_family = AF_INET6;
*addr_len = sizeof(*sin6);
- if (in6_pton(string, str_len, addr, IPV6_SCOPE_DELIMITER, &delim)) {
- nfs_parse_ipv6_scope_id(string, str_len, delim, sin6);
- return;
+ if (in6_pton(string, str_len, addr,
+ IPV6_SCOPE_DELIMITER, &delim) != 0) {
+ if (nfs_parse_ipv6_scope_id(string, str_len,
+ delim, sin6) != 0)
+ return;
}
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] NFS: Remove checks for scope id's in v6 addresses in the fs-locations code
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
` (2 preceding siblings ...)
2008-10-09 19:00 ` [PATCH 3/4] NFS: Cleanup nfs_set_port Trond Myklebust
@ 2008-10-09 19:00 ` Trond Myklebust
3 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2008-10-09 19:00 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields
From: J. Bruce Fields <bfields@citi.umich.edu>
The concensus on the list is that servers should not be allowed to send
anything other than ordinary IPv6 addresses, or DNS hostnames in the
fs-locations attribute.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/internal.h | 2 --
fs/nfs/nfs4namespace.c | 2 --
fs/nfs/super.c | 2 ++
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 5d2a5d3..be091cb 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -277,8 +277,6 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
PAGE_SIZE - 1) >> PAGE_SHIFT;
}
-#define IPV6_SCOPE_DELIMITER '%'
-
/*
* Set the port number in an address. Be agnostic about the address
* family.
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 30befc3..13c37de 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -118,8 +118,6 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
mountdata->addr = (struct sockaddr *)&addr;
- if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len))
- continue;
nfs_parse_ip_address(buf->data, buf->len,
mountdata->addr, &mountdata->addrlen);
if (mountdata->addr->sa_family == AF_UNSPEC)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 20dc4cc..6b447f5 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -716,6 +716,8 @@ static void nfs_parse_ipv4_address(char *string, size_t str_len,
*addr_len = 0;
}
+#define IPV6_SCOPE_DELIMITER '%'
+
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
static void nfs_parse_ipv6_scope_id(const char *string, const size_t str_len,
const char *delim,
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] NFS: Cleanup nfs_set_port
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-09 19:00 ` [PATCH 4/4] NFS: fix nfs_parse_ip_address() corner case Trond Myklebust
2008-10-09 19:00 ` [PATCH 1/4] NFS: Fix attribute updates Trond Myklebust
@ 2008-10-09 19:00 ` Trond Myklebust
2008-10-09 19:00 ` [PATCH 2/4] NFS: Remove checks for scope id's in v6 addresses in the fs-locations code Trond Myklebust
3 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2008-10-09 19:00 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields
From: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/internal.h | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index be091cb..98dcc9c 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -283,16 +283,15 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
*/
static inline void nfs_set_port(struct sockaddr *sap, unsigned short port)
{
+ struct sockaddr_in *ap = (struct sockaddr_in *)sap;
+ struct sockaddr_in6 *ap6 = (struct sockaddr_in6 *)sap;
+
switch (sap->sa_family) {
- case AF_INET: {
- struct sockaddr_in *ap = (struct sockaddr_in *)sap;
- ap->sin_port = htons(port);
- break;
- }
- case AF_INET6: {
- struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
- ap->sin6_port = htons(port);
- break;
- }
+ case AF_INET:
+ ap->sin_port = htons(port);
+ break;
+ case AF_INET6:
+ ap6->sin6_port = htons(port);
+ break;
}
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-09 19:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 19:00 [PATCH 0/4] Fixups agains the nfs 'devel' branch Trond Myklebust
[not found] ` <20081009190031.18388.95039.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-10-09 19:00 ` [PATCH 4/4] NFS: fix nfs_parse_ip_address() corner case Trond Myklebust
2008-10-09 19:00 ` [PATCH 1/4] NFS: Fix attribute updates Trond Myklebust
2008-10-09 19:00 ` [PATCH 3/4] NFS: Cleanup nfs_set_port Trond Myklebust
2008-10-09 19:00 ` [PATCH 2/4] NFS: Remove checks for scope id's in v6 addresses in the fs-locations code Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox