Skip to content

Commit 4e4adb2

Browse files
committed
Merge tag 'nfs-for-4.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust: "Highlights include: Stable patches: - Fix atomicity of pNFS commit list updates - Fix NFSv4 handling of open(O_CREAT|O_EXCL|O_RDONLY) - nfs_set_pgio_error sometimes misses errors - Fix a thinko in xs_connect() - Fix borkage in _same_data_server_addrs_locked() - Fix a NULL pointer dereference of migration recovery ops for v4.2 client - Don't let the ctime override attribute barriers. - Revert "NFSv4: Remove incorrect check in can_open_delegated()" - Ensure flexfiles pNFS driver updates the inode after write finishes - flexfiles must not pollute the attribute cache with attrbutes from the DS - Fix a protocol error in layoutreturn - Fix a protocol issue with NFSv4.1 CLOSE stateids Bugfixes + cleanups - pNFS blocks bugfixes from Christoph - Various cleanups from Anna - More fixes for delegation corner cases - Don't fsync twice for O_SYNC/IS_SYNC files - Fix pNFS and flexfiles layoutstats bugs - pnfs/flexfiles: avoid duplicate tracking of mirror data - pnfs: Fix layoutget/layoutreturn/return-on-close serialisation issues - pnfs/flexfiles: error handling retries a layoutget before fallback to MDS Features: - Full support for the OPEN NFS4_CREATE_EXCLUSIVE4_1 mode from Kinglong - More RDMA client transport improvements from Chuck - Removal of the deprecated ib_reg_phys_mr() and ib_rereg_phys_mr() verbs from the SUNRPC, Lustre and core infiniband tree. - Optimise away the close-to-open getattr if there is no cached data" * tag 'nfs-for-4.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (108 commits) NFSv4: Respect the server imposed limit on how many changes we may cache NFSv4: Express delegation limit in units of pages Revert "NFS: Make close(2) asynchronous when closing NFS O_DIRECT files" NFS: Optimise away the close-to-open getattr if there is no cached data NFSv4.1/flexfiles: Clean up ff_layout_write_done_cb/ff_layout_commit_done_cb NFSv4.1/flexfiles: Mark the layout for return in ff_layout_io_track_ds_error() nfs: Remove unneeded checking of the return value from scnprintf nfs: Fix truncated client owner id without proto type NFSv4.1/flexfiles: Mark layout for return if the mirrors are invalid NFSv4.1/flexfiles: RW layouts are valid only if all mirrors are valid NFSv4.1/flexfiles: Fix incorrect usage of pnfs_generic_mark_devid_invalid() NFSv4.1/flexfiles: Fix freeing of mirrors NFSv4.1/pNFS: Don't request a minimal read layout beyond the end of file NFSv4.1/pnfs: Handle LAYOUTGET return values correctly NFSv4.1/pnfs: Don't ask for a read layout for an empty file. NFSv4.1: Fix a protocol issue with CLOSE stateids NFSv4.1/flexfiles: Don't mark the entire deviceid as bad for file errors SUNRPC: Prevent SYN+SYNACK+RST storms SUNRPC: xs_reset_transport must mark the connection as disconnected NFSv4.1/pnfs: Ensure layoutreturn reserves space for the opaque payload ...
2 parents 77a7880 + 5445b1f commit 4e4adb2

54 files changed

Lines changed: 1321 additions & 1089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/kernel-parameters.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
22852285
The default parameter value of '0' causes the kernel
22862286
not to attempt recovery of lost locks.
22872287

2288+
nfs4.layoutstats_timer =
2289+
[NFSv4.2] Change the rate at which the kernel sends
2290+
layoutstats to the pNFS metadata server.
2291+
2292+
Setting this to value to 0 causes the kernel to use
2293+
whatever value is the default set by the layout
2294+
driver. A non-zero value sets the minimum interval
2295+
in seconds between layoutstats transmissions.
2296+
22882297
nfsd.nfs4_disable_idmapping=
22892298
[NFSv4] When set to the default of '1', the NFSv4
22902299
server will return only numeric uids and gids to

‎drivers/infiniband/core/verbs.c‎

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,73 +1144,6 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
11441144
}
11451145
EXPORT_SYMBOL(ib_get_dma_mr);
11461146

1147-
struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
1148-
struct ib_phys_buf *phys_buf_array,
1149-
int num_phys_buf,
1150-
int mr_access_flags,
1151-
u64 *iova_start)
1152-
{
1153-
struct ib_mr *mr;
1154-
int err;
1155-
1156-
err = ib_check_mr_access(mr_access_flags);
1157-
if (err)
1158-
return ERR_PTR(err);
1159-
1160-
if (!pd->device->reg_phys_mr)
1161-
return ERR_PTR(-ENOSYS);
1162-
1163-
mr = pd->device->reg_phys_mr(pd, phys_buf_array, num_phys_buf,
1164-
mr_access_flags, iova_start);
1165-
1166-
if (!IS_ERR(mr)) {
1167-
mr->device = pd->device;
1168-
mr->pd = pd;
1169-
mr->uobject = NULL;
1170-
atomic_inc(&pd->usecnt);
1171-
atomic_set(&mr->usecnt, 0);
1172-
}
1173-
1174-
return mr;
1175-
}
1176-
EXPORT_SYMBOL(ib_reg_phys_mr);
1177-
1178-
int ib_rereg_phys_mr(struct ib_mr *mr,
1179-
int mr_rereg_mask,
1180-
struct ib_pd *pd,
1181-
struct ib_phys_buf *phys_buf_array,
1182-
int num_phys_buf,
1183-
int mr_access_flags,
1184-
u64 *iova_start)
1185-
{
1186-
struct ib_pd *old_pd;
1187-
int ret;
1188-
1189-
ret = ib_check_mr_access(mr_access_flags);
1190-
if (ret)
1191-
return ret;
1192-
1193-
if (!mr->device->rereg_phys_mr)
1194-
return -ENOSYS;
1195-
1196-
if (atomic_read(&mr->usecnt))
1197-
return -EBUSY;
1198-
1199-
old_pd = mr->pd;
1200-
1201-
ret = mr->device->rereg_phys_mr(mr, mr_rereg_mask, pd,
1202-
phys_buf_array, num_phys_buf,
1203-
mr_access_flags, iova_start);
1204-
1205-
if (!ret && (mr_rereg_mask & IB_MR_REREG_PD)) {
1206-
atomic_dec(&old_pd->usecnt);
1207-
atomic_inc(&pd->usecnt);
1208-
}
1209-
1210-
return ret;
1211-
}
1212-
EXPORT_SYMBOL(ib_rereg_phys_mr);
1213-
12141147
int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr)
12151148
{
12161149
return mr->device->query_mr ?

‎fs/nfs/blocklayout/blocklayout.h‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@
4646

4747
struct pnfs_block_dev;
4848

49-
enum pnfs_block_volume_type {
50-
PNFS_BLOCK_VOLUME_SIMPLE = 0,
51-
PNFS_BLOCK_VOLUME_SLICE = 1,
52-
PNFS_BLOCK_VOLUME_CONCAT = 2,
53-
PNFS_BLOCK_VOLUME_STRIPE = 3,
54-
};
55-
5649
#define PNFS_BLOCK_MAX_UUIDS 4
5750
#define PNFS_BLOCK_MAX_DEVICES 64
5851

@@ -117,13 +110,6 @@ struct pnfs_block_dev {
117110
struct pnfs_block_dev_map *map);
118111
};
119112

120-
enum exstate4 {
121-
PNFS_BLOCK_READWRITE_DATA = 0,
122-
PNFS_BLOCK_READ_DATA = 1,
123-
PNFS_BLOCK_INVALID_DATA = 2, /* mapped, but data is invalid */
124-
PNFS_BLOCK_NONE_DATA = 3 /* unmapped, it's a hole */
125-
};
126-
127113
/* sector_t fields are all in 512-byte sectors */
128114
struct pnfs_block_extent {
129115
union {
@@ -134,15 +120,12 @@ struct pnfs_block_extent {
134120
sector_t be_f_offset; /* the starting offset in the file */
135121
sector_t be_length; /* the size of the extent */
136122
sector_t be_v_offset; /* the starting offset in the volume */
137-
enum exstate4 be_state; /* the state of this extent */
123+
enum pnfs_block_extent_state be_state; /* the state of this extent */
138124
#define EXTENT_WRITTEN 1
139125
#define EXTENT_COMMITTING 2
140126
unsigned int be_tag;
141127
};
142128

143-
/* on the wire size of the extent */
144-
#define BL_EXTENT_SIZE (7 * sizeof(__be32) + NFS4_DEVICEID4_SIZE)
145-
146129
struct pnfs_block_layout {
147130
struct pnfs_layout_hdr bl_layout;
148131
struct rb_root bl_ext_rw;

‎fs/nfs/blocklayout/dev.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bl_free_device(struct pnfs_block_dev *dev)
2222
kfree(dev->children);
2323
} else {
2424
if (dev->bdev)
25-
blkdev_put(dev->bdev, FMODE_READ);
25+
blkdev_put(dev->bdev, FMODE_READ | FMODE_WRITE);
2626
}
2727
}
2828

@@ -65,6 +65,11 @@ nfs4_block_decode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b)
6565
return -EIO;
6666
p = xdr_decode_hyper(p, &b->simple.sigs[i].offset);
6767
b->simple.sigs[i].sig_len = be32_to_cpup(p++);
68+
if (b->simple.sigs[i].sig_len > PNFS_BLOCK_UUID_LEN) {
69+
pr_info("signature too long: %d\n",
70+
b->simple.sigs[i].sig_len);
71+
return -EIO;
72+
}
6873

6974
p = xdr_inline_decode(xdr, b->simple.sigs[i].sig_len);
7075
if (!p)
@@ -195,7 +200,7 @@ bl_parse_simple(struct nfs_server *server, struct pnfs_block_dev *d,
195200
if (!dev)
196201
return -EIO;
197202

198-
d->bdev = blkdev_get_by_dev(dev, FMODE_READ, NULL);
203+
d->bdev = blkdev_get_by_dev(dev, FMODE_READ | FMODE_WRITE, NULL);
199204
if (IS_ERR(d->bdev)) {
200205
printk(KERN_WARNING "pNFS: failed to open device %d:%d (%ld)\n",
201206
MAJOR(dev), MINOR(dev), PTR_ERR(d->bdev));

‎fs/nfs/blocklayout/extent_tree.c‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,12 @@ ext_tree_mark_written(struct pnfs_block_layout *bl, sector_t start,
462462
return err;
463463
}
464464

465+
static size_t ext_tree_layoutupdate_size(size_t count)
466+
{
467+
return sizeof(__be32) /* number of entries */ +
468+
PNFS_BLOCK_EXTENT_SIZE * count;
469+
}
470+
465471
static void ext_tree_free_commitdata(struct nfs4_layoutcommit_args *arg,
466472
size_t buffer_size)
467473
{
@@ -489,7 +495,7 @@ static int ext_tree_encode_commit(struct pnfs_block_layout *bl, __be32 *p,
489495
continue;
490496

491497
(*count)++;
492-
if (*count * BL_EXTENT_SIZE > buffer_size) {
498+
if (ext_tree_layoutupdate_size(*count) > buffer_size) {
493499
/* keep counting.. */
494500
ret = -ENOSPC;
495501
continue;
@@ -530,7 +536,7 @@ ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg)
530536
if (unlikely(ret)) {
531537
ext_tree_free_commitdata(arg, buffer_size);
532538

533-
buffer_size = sizeof(__be32) + BL_EXTENT_SIZE * count;
539+
buffer_size = ext_tree_layoutupdate_size(count);
534540
count = 0;
535541

536542
arg->layoutupdate_pages =
@@ -549,17 +555,14 @@ ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg)
549555
}
550556

551557
*start_p = cpu_to_be32(count);
552-
arg->layoutupdate_len = sizeof(__be32) + BL_EXTENT_SIZE * count;
558+
arg->layoutupdate_len = ext_tree_layoutupdate_size(count);
553559

554560
if (unlikely(arg->layoutupdate_pages != &arg->layoutupdate_page)) {
555-
__be32 *p = start_p;
561+
void *p = start_p, *end = p + arg->layoutupdate_len;
556562
int i = 0;
557563

558-
for (p = start_p;
559-
p < start_p + arg->layoutupdate_len;
560-
p += PAGE_SIZE) {
564+
for ( ; p < end; p += PAGE_SIZE)
561565
arg->layoutupdate_pages[i++] = vmalloc_to_page(p);
562-
}
563566
}
564567

565568
dprintk("%s found %zu ranges\n", __func__, count);

‎fs/nfs/callback.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ nfs41_callback_up(struct svc_serv *serv)
162162
spin_lock_init(&serv->sv_cb_lock);
163163
init_waitqueue_head(&serv->sv_cb_waitq);
164164
rqstp = svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
165-
if (IS_ERR(rqstp)) {
166-
svc_xprt_put(serv->sv_bc_xprt);
167-
serv->sv_bc_xprt = NULL;
168-
}
169165
dprintk("--> %s return %d\n", __func__, PTR_ERR_OR_ZERO(rqstp));
170166
return rqstp;
171167
}

‎fs/nfs/callback_proc.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
4040
rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR));
4141

4242
inode = nfs_delegation_find_inode(cps->clp, &args->fh);
43-
if (inode == NULL)
43+
if (inode == NULL) {
44+
trace_nfs4_cb_getattr(cps->clp, &args->fh, NULL,
45+
-ntohl(res->status));
4446
goto out;
47+
}
4548
nfsi = NFS_I(inode);
4649
rcu_read_lock();
4750
delegation = rcu_dereference(nfsi->delegation);
@@ -60,6 +63,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
6063
res->status = 0;
6164
out_iput:
6265
rcu_read_unlock();
66+
trace_nfs4_cb_getattr(cps->clp, &args->fh, inode, -ntohl(res->status));
6367
iput(inode);
6468
out:
6569
dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status));
@@ -194,6 +198,7 @@ static u32 initiate_file_draining(struct nfs_client *clp,
194198
spin_unlock(&ino->i_lock);
195199
pnfs_free_lseg_list(&free_me_list);
196200
pnfs_put_layout_hdr(lo);
201+
trace_nfs4_cb_layoutrecall_inode(clp, &args->cbl_fh, ino, -rv);
197202
iput(ino);
198203
out:
199204
return rv;
@@ -554,7 +559,7 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy,
554559
status = htonl(NFS4_OK);
555560

556561
nfs41_set_target_slotid(fc_tbl, args->crsa_target_highest_slotid);
557-
nfs41_server_notify_target_slotid_update(cps->clp);
562+
nfs41_notify_server(cps->clp);
558563
out:
559564
dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
560565
return status;

‎fs/nfs/client.c‎

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/stat.h>
2121
#include <linux/errno.h>
2222
#include <linux/unistd.h>
23+
#include <linux/sunrpc/addr.h>
2324
#include <linux/sunrpc/clnt.h>
2425
#include <linux/sunrpc/stats.h>
2526
#include <linux/sunrpc/metrics.h>
@@ -285,116 +286,6 @@ void nfs_put_client(struct nfs_client *clp)
285286
}
286287
EXPORT_SYMBOL_GPL(nfs_put_client);
287288

288-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
289-
/*
290-
* Test if two ip6 socket addresses refer to the same socket by
291-
* comparing relevant fields. The padding bytes specifically, are not
292-
* compared. sin6_flowinfo is not compared because it only affects QoS
293-
* and sin6_scope_id is only compared if the address is "link local"
294-
* because "link local" addresses need only be unique to a specific
295-
* link. Conversely, ordinary unicast addresses might have different
296-
* sin6_scope_id.
297-
*
298-
* The caller should ensure both socket addresses are AF_INET6.
299-
*/
300-
static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
301-
const struct sockaddr *sa2)
302-
{
303-
const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
304-
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
305-
306-
if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
307-
return 0;
308-
else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
309-
return sin1->sin6_scope_id == sin2->sin6_scope_id;
310-
311-
return 1;
312-
}
313-
#else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */
314-
static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
315-
const struct sockaddr *sa2)
316-
{
317-
return 0;
318-
}
319-
#endif
320-
321-
/*
322-
* Test if two ip4 socket addresses refer to the same socket, by
323-
* comparing relevant fields. The padding bytes specifically, are
324-
* not compared.
325-
*
326-
* The caller should ensure both socket addresses are AF_INET.
327-
*/
328-
static int nfs_sockaddr_match_ipaddr4(const struct sockaddr *sa1,
329-
const struct sockaddr *sa2)
330-
{
331-
const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sa1;
332-
const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sa2;
333-
334-
return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
335-
}
336-
337-
static int nfs_sockaddr_cmp_ip6(const struct sockaddr *sa1,
338-
const struct sockaddr *sa2)
339-
{
340-
const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
341-
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
342-
343-
return nfs_sockaddr_match_ipaddr6(sa1, sa2) &&
344-
(sin1->sin6_port == sin2->sin6_port);
345-
}
346-
347-
static int nfs_sockaddr_cmp_ip4(const struct sockaddr *sa1,
348-
const struct sockaddr *sa2)
349-
{
350-
const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sa1;
351-
const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sa2;
352-
353-
return nfs_sockaddr_match_ipaddr4(sa1, sa2) &&
354-
(sin1->sin_port == sin2->sin_port);
355-
}
356-
357-
#if defined(CONFIG_NFS_V4_1)
358-
/*
359-
* Test if two socket addresses represent the same actual socket,
360-
* by comparing (only) relevant fields, excluding the port number.
361-
*/
362-
int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
363-
const struct sockaddr *sa2)
364-
{
365-
if (sa1->sa_family != sa2->sa_family)
366-
return 0;
367-
368-
switch (sa1->sa_family) {
369-
case AF_INET:
370-
return nfs_sockaddr_match_ipaddr4(sa1, sa2);
371-
case AF_INET6:
372-
return nfs_sockaddr_match_ipaddr6(sa1, sa2);
373-
}
374-
return 0;
375-
}
376-
EXPORT_SYMBOL_GPL(nfs_sockaddr_match_ipaddr);
377-
#endif /* CONFIG_NFS_V4_1 */
378-
379-
/*
380-
* Test if two socket addresses represent the same actual socket,
381-
* by comparing (only) relevant fields, including the port number.
382-
*/
383-
static int nfs_sockaddr_cmp(const struct sockaddr *sa1,
384-
const struct sockaddr *sa2)
385-
{
386-
if (sa1->sa_family != sa2->sa_family)
387-
return 0;
388-
389-
switch (sa1->sa_family) {
390-
case AF_INET:
391-
return nfs_sockaddr_cmp_ip4(sa1, sa2);
392-
case AF_INET6:
393-
return nfs_sockaddr_cmp_ip6(sa1, sa2);
394-
}
395-
return 0;
396-
}
397-
398289
/*
399290
* Find an nfs_client on the list that matches the initialisation data
400291
* that is supplied.
@@ -421,7 +312,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
421312
if (clp->cl_minorversion != data->minorversion)
422313
continue;
423314
/* Match the full socket address */
424-
if (!nfs_sockaddr_cmp(sap, clap))
315+
if (!rpc_cmp_addr_port(sap, clap))
425316
continue;
426317

427318
atomic_inc(&clp->cl_count);

0 commit comments

Comments
 (0)