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

Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
NFS: Fix an Oops in the NFSv4 atomic open code
NFS: Fix the selection of security flavours in Kconfig
NFS: fix the return value of nfs_file_fsync()
rpcrdma: Fix SQ size calculation when memreg is FRMR
xprtrdma: Do not truncate iova_start values in frmr registrations.
nfs: Remove redundant NULL check upon kfree()
nfs: Add "lookupcache" to displayed mount options
NFS: allow close-to-open cache semantics to apply to root of NFS filesystem
SUNRPC: fix NFS client over TCP hangs due to packet loss (Bug 16494)

+68 -24
-1
fs/nfs/Kconfig
··· 63 63 config NFS_V4 64 64 bool "NFS client support for NFS version 4" 65 65 depends on NFS_FS 66 - select RPCSEC_GSS_KRB5 67 66 help 68 67 This option enables support for version 4 of the NFS protocol 69 68 (RFC 3530) in the kernel's NFS client.
+8 -1
fs/nfs/dir.c
··· 140 140 141 141 /* Call generic open code in order to cache credentials */ 142 142 res = nfs_open(inode, filp); 143 + if (filp->f_path.dentry == filp->f_path.mnt->mnt_root) { 144 + /* This is a mountpoint, so d_revalidate will never 145 + * have been called, so we need to refresh the 146 + * inode (for close-open consistency) ourselves. 147 + */ 148 + __nfs_revalidate_inode(NFS_SERVER(inode), inode); 149 + } 143 150 return res; 144 151 } 145 152 ··· 1110 1103 if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) 1111 1104 goto no_open_dput; 1112 1105 /* We can't create new files, or truncate existing ones here */ 1113 - openflags &= ~(O_CREAT|O_TRUNC); 1106 + openflags &= ~(O_CREAT|O_EXCL|O_TRUNC); 1114 1107 1115 1108 /* 1116 1109 * Note: we're not holding inode->i_mutex and so may be racing with
+1 -1
fs/nfs/file.c
··· 323 323 have_error |= test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags); 324 324 if (have_error) 325 325 ret = xchg(&ctx->error, 0); 326 - if (!ret) 326 + if (!ret && status < 0) 327 327 ret = status; 328 328 return ret; 329 329 }
+6 -5
fs/nfs/nfs4proc.c
··· 2036 2036 struct rpc_cred *cred; 2037 2037 struct nfs4_state *state; 2038 2038 struct dentry *res; 2039 - fmode_t fmode = nd->intent.open.flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); 2039 + int open_flags = nd->intent.open.flags; 2040 + fmode_t fmode = open_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); 2040 2041 2041 2042 if (nd->flags & LOOKUP_CREATE) { 2042 2043 attr.ia_mode = nd->intent.open.create_mode; ··· 2045 2044 if (!IS_POSIXACL(dir)) 2046 2045 attr.ia_mode &= ~current_umask(); 2047 2046 } else { 2047 + open_flags &= ~O_EXCL; 2048 2048 attr.ia_valid = 0; 2049 - BUG_ON(nd->intent.open.flags & O_CREAT); 2049 + BUG_ON(open_flags & O_CREAT); 2050 2050 } 2051 2051 2052 2052 cred = rpc_lookup_cred(); ··· 2056 2054 parent = dentry->d_parent; 2057 2055 /* Protect against concurrent sillydeletes */ 2058 2056 nfs_block_sillyrename(parent); 2059 - state = nfs4_do_open(dir, &path, fmode, nd->intent.open.flags, &attr, cred); 2057 + state = nfs4_do_open(dir, &path, fmode, open_flags, &attr, cred); 2060 2058 put_rpccred(cred); 2061 2059 if (IS_ERR(state)) { 2062 2060 if (PTR_ERR(state) == -ENOENT) { ··· 2275 2273 out: 2276 2274 if (page) 2277 2275 __free_page(page); 2278 - if (locations) 2279 - kfree(locations); 2276 + kfree(locations); 2280 2277 return status; 2281 2278 } 2282 2279
+7
fs/nfs/super.c
··· 655 655 656 656 if (nfss->options & NFS_OPTION_FSCACHE) 657 657 seq_printf(m, ",fsc"); 658 + 659 + if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) { 660 + if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE) 661 + seq_printf(m, ",lookupcache=none"); 662 + else 663 + seq_printf(m, ",lookupcache=pos"); 664 + } 658 665 } 659 666 660 667 /*
-1
fs/nfsd/Kconfig
··· 69 69 depends on NFSD && PROC_FS && EXPERIMENTAL 70 70 select NFSD_V3 71 71 select FS_POSIX_ACL 72 - select RPCSEC_GSS_KRB5 73 72 help 74 73 This option enables support in your system's NFS server for 75 74 version 4 of the NFS protocol (RFC 3530).
+5 -4
net/sunrpc/Kconfig
··· 18 18 If unsure, say N. 19 19 20 20 config RPCSEC_GSS_KRB5 21 - tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)" 22 - depends on SUNRPC && EXPERIMENTAL 21 + tristate 22 + depends on SUNRPC && CRYPTO 23 + prompt "Secure RPC: Kerberos V mechanism" if !(NFS_V4 || NFSD_V4) 24 + default y 23 25 select SUNRPC_GSS 24 - select CRYPTO 25 26 select CRYPTO_MD5 26 27 select CRYPTO_DES 27 28 select CRYPTO_CBC ··· 35 34 available from http://linux-nfs.org/. In addition, user-space 36 35 Kerberos support should be installed. 37 36 38 - If unsure, say N. 37 + If unsure, say Y. 39 38 40 39 config RPCSEC_GSS_SPKM3 41 40 tristate "Secure RPC: SPKM3 mechanism (EXPERIMENTAL)"
+2
net/sunrpc/xprtrdma/rpc_rdma.c
··· 249 249 req->rl_nchunks = nchunks; 250 250 251 251 BUG_ON(nchunks == 0); 252 + BUG_ON((r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR) 253 + && (nchunks > 3)); 252 254 253 255 /* 254 256 * finish off header. If write, marshal discrim and nchunks.
+17 -5
net/sunrpc/xprtrdma/verbs.c
··· 650 650 ep->rep_attr.cap.max_send_wr = cdata->max_requests; 651 651 switch (ia->ri_memreg_strategy) { 652 652 case RPCRDMA_FRMR: 653 - /* Add room for frmr register and invalidate WRs */ 654 - ep->rep_attr.cap.max_send_wr *= 3; 655 - if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) 656 - return -EINVAL; 653 + /* Add room for frmr register and invalidate WRs. 654 + * 1. FRMR reg WR for head 655 + * 2. FRMR invalidate WR for head 656 + * 3. FRMR reg WR for pagelist 657 + * 4. FRMR invalidate WR for pagelist 658 + * 5. FRMR reg WR for tail 659 + * 6. FRMR invalidate WR for tail 660 + * 7. The RDMA_SEND WR 661 + */ 662 + ep->rep_attr.cap.max_send_wr *= 7; 663 + if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) { 664 + cdata->max_requests = devattr.max_qp_wr / 7; 665 + if (!cdata->max_requests) 666 + return -EINVAL; 667 + ep->rep_attr.cap.max_send_wr = cdata->max_requests * 7; 668 + } 657 669 break; 658 670 case RPCRDMA_MEMWINDOWS_ASYNC: 659 671 case RPCRDMA_MEMWINDOWS: ··· 1502 1490 memset(&frmr_wr, 0, sizeof frmr_wr); 1503 1491 frmr_wr.opcode = IB_WR_FAST_REG_MR; 1504 1492 frmr_wr.send_flags = 0; /* unsignaled */ 1505 - frmr_wr.wr.fast_reg.iova_start = (unsigned long)seg1->mr_dma; 1493 + frmr_wr.wr.fast_reg.iova_start = seg1->mr_dma; 1506 1494 frmr_wr.wr.fast_reg.page_list = seg1->mr_chunk.rl_mw->r.frmr.fr_pgl; 1507 1495 frmr_wr.wr.fast_reg.page_list_len = i; 1508 1496 frmr_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
+22 -6
net/sunrpc/xprtsock.c
··· 1305 1305 if (!(xprt = xprt_from_sock(sk))) 1306 1306 goto out; 1307 1307 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); 1308 - dprintk("RPC: state %x conn %d dead %d zapped %d\n", 1308 + dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n", 1309 1309 sk->sk_state, xprt_connected(xprt), 1310 1310 sock_flag(sk, SOCK_DEAD), 1311 - sock_flag(sk, SOCK_ZAPPED)); 1311 + sock_flag(sk, SOCK_ZAPPED), 1312 + sk->sk_shutdown); 1312 1313 1313 1314 switch (sk->sk_state) { 1314 1315 case TCP_ESTABLISHED: ··· 1780 1779 { 1781 1780 unsigned int state = transport->inet->sk_state; 1782 1781 1783 - if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) 1784 - return; 1785 - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) 1786 - return; 1782 + if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) { 1783 + /* we don't need to abort the connection if the socket 1784 + * hasn't undergone a shutdown 1785 + */ 1786 + if (transport->inet->sk_shutdown == 0) 1787 + return; 1788 + dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set to %d\n", 1789 + __func__, transport->inet->sk_shutdown); 1790 + } 1791 + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) { 1792 + /* we don't need to abort the connection if the socket 1793 + * hasn't undergone a shutdown 1794 + */ 1795 + if (transport->inet->sk_shutdown == 0) 1796 + return; 1797 + dprintk("RPC: %s: ESTABLISHED/SYN_SENT " 1798 + "sk_shutdown set to %d\n", 1799 + __func__, transport->inet->sk_shutdown); 1800 + } 1787 1801 xs_abort_connection(xprt, transport); 1788 1802 } 1789 1803