Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nfs-for-5.20-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:

- Fix SUNRPC call completion races with call_decode() that trigger a
WARN_ON()

- NFSv4.0 cannot support open-by-filehandle and NFS re-export

- Revert "SUNRPC: Remove unreachable error condition" to allow handling
of error conditions

- Update suid/sgid mode bits after ALLOCATE and DEALLOCATE

* tag 'nfs-for-5.20-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
Revert "SUNRPC: Remove unreachable error condition"
NFSv4.2: Update mode bits after ALLOCATE and DEALLOCATE
NFSv4: Turn off open-by-filehandle and NFS re-export for NFSv4.0
SUNRPC: Fix call completion races with call_decode()

+57 -40
+25
fs/nfs/internal.h
··· 606 606 return GFP_KERNEL; 607 607 } 608 608 609 + /* 610 + * Special version of should_remove_suid() that ignores capabilities. 611 + */ 612 + static inline int nfs_should_remove_suid(const struct inode *inode) 613 + { 614 + umode_t mode = inode->i_mode; 615 + int kill = 0; 616 + 617 + /* suid always must be killed */ 618 + if (unlikely(mode & S_ISUID)) 619 + kill = ATTR_KILL_SUID; 620 + 621 + /* 622 + * sgid without any exec bits is just a mandatory locking mark; leave 623 + * it alone. If some exec bits are set, it's a real sgid; kill it. 624 + */ 625 + if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 626 + kill |= ATTR_KILL_SGID; 627 + 628 + if (unlikely(kill && S_ISREG(mode))) 629 + return kill; 630 + 631 + return 0; 632 + } 633 + 609 634 /* unlink.c */ 610 635 extern struct rpc_task * 611 636 nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
+7 -2
fs/nfs/nfs42proc.c
··· 78 78 79 79 status = nfs4_call_sync(server->client, server, msg, 80 80 &args.seq_args, &res.seq_res, 0); 81 - if (status == 0) 81 + if (status == 0) { 82 + if (nfs_should_remove_suid(inode)) { 83 + spin_lock(&inode->i_lock); 84 + nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE); 85 + spin_unlock(&inode->i_lock); 86 + } 82 87 status = nfs_post_op_update_inode_force_wcc(inode, 83 88 res.falloc_fattr); 84 - 89 + } 85 90 if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE]) 86 91 trace_nfs4_fallocate(inode, &args, status); 87 92 else
+18 -9
fs/nfs/super.c
··· 1051 1051 if (ctx->bsize) 1052 1052 sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits); 1053 1053 1054 - if (server->nfs_client->rpc_ops->version != 2) { 1055 - /* The VFS shouldn't apply the umask to mode bits. We will do 1056 - * so ourselves when necessary. 1054 + switch (server->nfs_client->rpc_ops->version) { 1055 + case 2: 1056 + sb->s_time_gran = 1000; 1057 + sb->s_time_min = 0; 1058 + sb->s_time_max = U32_MAX; 1059 + break; 1060 + case 3: 1061 + /* 1062 + * The VFS shouldn't apply the umask to mode bits. 1063 + * We will do so ourselves when necessary. 1057 1064 */ 1058 1065 sb->s_flags |= SB_POSIXACL; 1059 1066 sb->s_time_gran = 1; 1060 - sb->s_export_op = &nfs_export_ops; 1061 - } else 1062 - sb->s_time_gran = 1000; 1063 - 1064 - if (server->nfs_client->rpc_ops->version != 4) { 1065 1067 sb->s_time_min = 0; 1066 1068 sb->s_time_max = U32_MAX; 1067 - } else { 1069 + sb->s_export_op = &nfs_export_ops; 1070 + break; 1071 + case 4: 1072 + sb->s_flags |= SB_POSIXACL; 1073 + sb->s_time_gran = 1; 1068 1074 sb->s_time_min = S64_MIN; 1069 1075 sb->s_time_max = S64_MAX; 1076 + if (server->caps & NFS_CAP_ATOMIC_OPEN_V1) 1077 + sb->s_export_op = &nfs_export_ops; 1078 + break; 1070 1079 } 1071 1080 1072 1081 sb->s_magic = NFS_SUPER_MAGIC;
-25
fs/nfs/write.c
··· 1496 1496 NFS_PROTO(data->inode)->commit_rpc_prepare(task, data); 1497 1497 } 1498 1498 1499 - /* 1500 - * Special version of should_remove_suid() that ignores capabilities. 1501 - */ 1502 - static int nfs_should_remove_suid(const struct inode *inode) 1503 - { 1504 - umode_t mode = inode->i_mode; 1505 - int kill = 0; 1506 - 1507 - /* suid always must be killed */ 1508 - if (unlikely(mode & S_ISUID)) 1509 - kill = ATTR_KILL_SUID; 1510 - 1511 - /* 1512 - * sgid without any exec bits is just a mandatory locking mark; leave 1513 - * it alone. If some exec bits are set, it's a real sgid; kill it. 1514 - */ 1515 - if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 1516 - kill |= ATTR_KILL_SGID; 1517 - 1518 - if (unlikely(kill && S_ISREG(mode))) 1519 - return kill; 1520 - 1521 - return 0; 1522 - } 1523 - 1524 1499 static void nfs_writeback_check_extend(struct nfs_pgio_header *hdr, 1525 1500 struct nfs_fattr *fattr) 1526 1501 {
+3
net/sunrpc/clnt.c
··· 2873 2873 2874 2874 task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC, 2875 2875 &rpc_cb_add_xprt_call_ops, data); 2876 + if (IS_ERR(task)) 2877 + return PTR_ERR(task); 2878 + 2876 2879 data->xps->xps_nunique_destaddr_xprts++; 2877 2880 rpc_put_task(task); 2878 2881 success:
+4 -4
net/sunrpc/xprt.c
··· 1179 1179 { 1180 1180 struct rpc_rqst *req = task->tk_rqstp; 1181 1181 1182 - if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { 1182 + if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) 1183 1183 xprt_request_rb_remove(req->rq_xprt, req); 1184 - xdr_free_bvec(&req->rq_rcv_buf); 1185 - req->rq_private_buf.bvec = NULL; 1186 - } 1187 1184 } 1188 1185 1189 1186 /** ··· 1218 1221 1219 1222 xprt->stat.recvs++; 1220 1223 1224 + xdr_free_bvec(&req->rq_rcv_buf); 1225 + req->rq_private_buf.bvec = NULL; 1221 1226 req->rq_private_buf.len = copied; 1222 1227 /* Ensure all writes are done before we update */ 1223 1228 /* req->rq_reply_bytes_recvd */ ··· 1452 1453 xprt_request_dequeue_transmit_locked(task); 1453 1454 xprt_request_dequeue_receive_locked(task); 1454 1455 spin_unlock(&xprt->queue_lock); 1456 + xdr_free_bvec(&req->rq_rcv_buf); 1455 1457 } 1456 1458 } 1457 1459