From: John L. Hammond Date: Wed, 6 Jan 2021 19:48:35 +0000 (-0600) Subject: LU-14301 llite: return EOPNOTSUPP if fallocate is not supported X-Git-Tag: 2.14.0-RC1~29 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=71a9f5a466bfa46436535e3173d1fed37ca12aea;hp=98b7df0be162581a143bfd4e60ac921b5d0b7394 LU-14301 llite: return EOPNOTSUPP if fallocate is not supported In ll_fallocate() if the server returns the NFSv3 specific error code ENOTSUPP then replace it with EOPNOTSUPP to avoid confusing applications. Signed-off-by: John L. Hammond Change-Id: I85952be27808704112a6902684900cd938d576ac Reviewed-on: https://review.whamcloud.com/41148 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Arshad Hussain Reviewed-by: Wang Shilong Tested-by: Maloo --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2da3896..2e78b2d 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5083,6 +5083,14 @@ long ll_fallocate(struct file *filp, int mode, loff_t offset, loff_t len) ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FALLOCATE, 1); rc = cl_falloc(inode, mode, offset, len); + /* + * ENOTSUPP (524) is an NFSv3 specific error code erroneously + * used by Lustre in several places. Retuning it here would + * confuse applications that explicity test for EOPNOTSUPP + * (95) and fall back to ftruncate(). + */ + if (rc == -ENOTSUPP) + rc = -EOPNOTSUPP; RETURN(rc); }