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-4.19-2' of git://git.linux-nfs.org/projects/anna/linux-nfs

Pull NFS client bugfixes from Anna Schumaker:
"These are a handful of fixes for problems that Trond found. Patch #1
and #3 have the same name, a second issue was found after applying the
first patch.

Stable bugfixes:
- v4.17+: Fix tracepoint Oops in initiate_file_draining()
- v4.11+: Fix an infinite loop on I/O

Other fixes:
- Return errors if a waiting layoutget is killed
- Don't open code clearing of delegation state"

* tag 'nfs-for-4.19-2' of git://git.linux-nfs.org/projects/anna/linux-nfs:
NFS: Don't open code clearing of delegation state
NFSv4.1 fix infinite loop on I/O.
NFSv4: Fix a tracepoint Oops in initiate_file_draining()
pNFS: Ensure we return the error if someone kills a waiting layoutget
NFSv4: Fix a tracepoint Oops in initiate_file_draining()

+39 -24
+19 -12
fs/nfs/nfs4proc.c
··· 1637 1637 write_sequnlock(&state->seqlock); 1638 1638 } 1639 1639 1640 + static void nfs_state_clear_delegation(struct nfs4_state *state) 1641 + { 1642 + write_seqlock(&state->seqlock); 1643 + nfs4_stateid_copy(&state->stateid, &state->open_stateid); 1644 + clear_bit(NFS_DELEGATED_STATE, &state->flags); 1645 + write_sequnlock(&state->seqlock); 1646 + } 1647 + 1640 1648 static int update_open_stateid(struct nfs4_state *state, 1641 1649 const nfs4_stateid *open_stateid, 1642 1650 const nfs4_stateid *delegation, ··· 2153 2145 if (IS_ERR(opendata)) 2154 2146 return PTR_ERR(opendata); 2155 2147 nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); 2156 - write_seqlock(&state->seqlock); 2157 - nfs4_stateid_copy(&state->stateid, &state->open_stateid); 2158 - write_sequnlock(&state->seqlock); 2159 - clear_bit(NFS_DELEGATED_STATE, &state->flags); 2148 + nfs_state_clear_delegation(state); 2160 2149 switch (type & (FMODE_READ|FMODE_WRITE)) { 2161 2150 case FMODE_READ|FMODE_WRITE: 2162 2151 case FMODE_WRITE: ··· 2606 2601 const nfs4_stateid *stateid) 2607 2602 { 2608 2603 nfs_remove_bad_delegation(state->inode, stateid); 2609 - write_seqlock(&state->seqlock); 2610 - nfs4_stateid_copy(&state->stateid, &state->open_stateid); 2611 - write_sequnlock(&state->seqlock); 2612 - clear_bit(NFS_DELEGATED_STATE, &state->flags); 2604 + nfs_state_clear_delegation(state); 2613 2605 } 2614 2606 2615 2607 static void nfs40_clear_delegation_stateid(struct nfs4_state *state) ··· 2674 2672 delegation = rcu_dereference(NFS_I(state->inode)->delegation); 2675 2673 if (delegation == NULL) { 2676 2674 rcu_read_unlock(); 2675 + nfs_state_clear_delegation(state); 2677 2676 return; 2678 2677 } 2679 2678 2680 2679 nfs4_stateid_copy(&stateid, &delegation->stateid); 2681 - if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags) || 2682 - !test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED, 2683 - &delegation->flags)) { 2680 + if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) { 2684 2681 rcu_read_unlock(); 2685 - nfs_finish_clear_delegation_stateid(state, &stateid); 2682 + nfs_state_clear_delegation(state); 2683 + return; 2684 + } 2685 + 2686 + if (!test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED, 2687 + &delegation->flags)) { 2688 + rcu_read_unlock(); 2686 2689 return; 2687 2690 } 2688 2691
+2
fs/nfs/nfs4state.c
··· 1390 1390 1391 1391 if (!nfs4_state_mark_reclaim_nograce(clp, state)) 1392 1392 return -EBADF; 1393 + nfs_inode_find_delegation_state_and_recover(state->inode, 1394 + &state->stateid); 1393 1395 dprintk("%s: scheduling stateid recovery for server %s\n", __func__, 1394 1396 clp->cl_hostname); 1395 1397 nfs4_schedule_state_manager(clp);
+2 -2
fs/nfs/nfs4trace.h
··· 1137 1137 TP_fast_assign( 1138 1138 __entry->error = error; 1139 1139 __entry->fhandle = nfs_fhandle_hash(fhandle); 1140 - if (inode != NULL) { 1140 + if (!IS_ERR_OR_NULL(inode)) { 1141 1141 __entry->fileid = NFS_FILEID(inode); 1142 1142 __entry->dev = inode->i_sb->s_dev; 1143 1143 } else { ··· 1194 1194 TP_fast_assign( 1195 1195 __entry->error = error; 1196 1196 __entry->fhandle = nfs_fhandle_hash(fhandle); 1197 - if (inode != NULL) { 1197 + if (!IS_ERR_OR_NULL(inode)) { 1198 1198 __entry->fileid = NFS_FILEID(inode); 1199 1199 __entry->dev = inode->i_sb->s_dev; 1200 1200 } else {
+16 -10
fs/nfs/pnfs.c
··· 1740 1740 return ret; 1741 1741 } 1742 1742 1743 - static bool pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo) 1743 + static int pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo) 1744 1744 { 1745 1745 /* 1746 1746 * send layoutcommit as it can hold up layoutreturn due to lseg 1747 1747 * reference 1748 1748 */ 1749 1749 pnfs_layoutcommit_inode(lo->plh_inode, false); 1750 - return !wait_on_bit_action(&lo->plh_flags, NFS_LAYOUT_RETURN, 1750 + return wait_on_bit_action(&lo->plh_flags, NFS_LAYOUT_RETURN, 1751 1751 nfs_wait_bit_killable, 1752 - TASK_UNINTERRUPTIBLE); 1752 + TASK_KILLABLE); 1753 1753 } 1754 1754 1755 1755 static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo) ··· 1830 1830 } 1831 1831 1832 1832 lookup_again: 1833 - nfs4_client_recover_expired_lease(clp); 1833 + lseg = ERR_PTR(nfs4_client_recover_expired_lease(clp)); 1834 + if (IS_ERR(lseg)) 1835 + goto out; 1834 1836 first = false; 1835 1837 spin_lock(&ino->i_lock); 1836 1838 lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags); ··· 1865 1863 if (list_empty(&lo->plh_segs) && 1866 1864 atomic_read(&lo->plh_outstanding) != 0) { 1867 1865 spin_unlock(&ino->i_lock); 1868 - if (wait_var_event_killable(&lo->plh_outstanding, 1869 - atomic_read(&lo->plh_outstanding) == 0 1870 - || !list_empty(&lo->plh_segs))) 1866 + lseg = ERR_PTR(wait_var_event_killable(&lo->plh_outstanding, 1867 + atomic_read(&lo->plh_outstanding))); 1868 + if (IS_ERR(lseg) || !list_empty(&lo->plh_segs)) 1871 1869 goto out_put_layout_hdr; 1872 1870 pnfs_put_layout_hdr(lo); 1873 1871 goto lookup_again; ··· 1900 1898 if (test_and_set_bit(NFS_LAYOUT_FIRST_LAYOUTGET, 1901 1899 &lo->plh_flags)) { 1902 1900 spin_unlock(&ino->i_lock); 1903 - wait_on_bit(&lo->plh_flags, NFS_LAYOUT_FIRST_LAYOUTGET, 1904 - TASK_UNINTERRUPTIBLE); 1901 + lseg = ERR_PTR(wait_on_bit(&lo->plh_flags, 1902 + NFS_LAYOUT_FIRST_LAYOUTGET, 1903 + TASK_KILLABLE)); 1904 + if (IS_ERR(lseg)) 1905 + goto out_put_layout_hdr; 1905 1906 pnfs_put_layout_hdr(lo); 1906 1907 dprintk("%s retrying\n", __func__); 1907 1908 goto lookup_again; ··· 1930 1925 if (test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) { 1931 1926 spin_unlock(&ino->i_lock); 1932 1927 dprintk("%s wait for layoutreturn\n", __func__); 1933 - if (pnfs_prepare_to_retry_layoutget(lo)) { 1928 + lseg = ERR_PTR(pnfs_prepare_to_retry_layoutget(lo)); 1929 + if (!IS_ERR(lseg)) { 1934 1930 if (first) 1935 1931 pnfs_clear_first_layoutget(lo); 1936 1932 pnfs_put_layout_hdr(lo);