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

nfsd: Set lc_size_chg before ops->proc_layoutcommit

After proc_layoutcommit success, i_size_read(inode) always >= new_size.
Just set lc_size_chg before proc_layoutcommit, if proc_layoutcommit
failed, nfsd will skip the lc_size_chg, so it's no harm.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Kinglong Mee and committed by
J. Bruce Fields
d8398fc1 28e51af7

+1 -5
+1 -5
fs/nfsd/nfs4proc.c
··· 1364 1364 goto out; 1365 1365 } 1366 1366 1367 - nfserr = ops->proc_layoutcommit(inode, lcp); 1368 - if (nfserr) 1369 - goto out_put_stid; 1370 - 1371 1367 if (new_size > i_size_read(inode)) { 1372 1368 lcp->lc_size_chg = 1; 1373 1369 lcp->lc_newsize = new_size; ··· 1371 1375 lcp->lc_size_chg = 0; 1372 1376 } 1373 1377 1374 - out_put_stid: 1378 + nfserr = ops->proc_layoutcommit(inode, lcp); 1375 1379 nfs4_put_stid(&ls->ls_stid); 1376 1380 out: 1377 1381 return nfserr;