Whamcloud - gitweb
LU-14301 llite: return EOPNOTSUPP if fallocate is not supported
[fs/lustre-release.git] / lustre / llite / file.c
index 5e3debe..2e78b2d 100644 (file)
@@ -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);
 }
@@ -5113,6 +5121,15 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 
        rc = ll_do_fiemap(inode, fiemap, num_bytes);
 
+       if (IS_ENCRYPTED(inode)) {
+               int i;
+
+               for (i = 0; i < fiemap->fm_mapped_extents; i++)
+                       fiemap->fm_extents[i].fe_flags |=
+                               FIEMAP_EXTENT_DATA_ENCRYPTED |
+                               FIEMAP_EXTENT_ENCODED;
+       }
+
        fieinfo->fi_flags = fiemap->fm_flags;
        fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents;
        if (extent_count > 0 &&