From: Greg Kroah-Hartman Date: Sun, 21 Mar 2021 12:13:16 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v4.4.263~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e446aa2a7f767ff068a188983c0ff43eb904dd1;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: cifs-fix-allocation-size-on-newly-created-files.patch riscv-correct-sparsemem-configuration.patch --- diff --git a/queue-5.10/cifs-fix-allocation-size-on-newly-created-files.patch b/queue-5.10/cifs-fix-allocation-size-on-newly-created-files.patch new file mode 100644 index 00000000000..07987729e3a --- /dev/null +++ b/queue-5.10/cifs-fix-allocation-size-on-newly-created-files.patch @@ -0,0 +1,58 @@ +From 65af8f0166f4d15e61c63db498ec7981acdd897f Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Fri, 19 Mar 2021 00:05:48 -0500 +Subject: cifs: fix allocation size on newly created files + +From: Steve French + +commit 65af8f0166f4d15e61c63db498ec7981acdd897f upstream. + +Applications that create and extend and write to a file do not +expect to see 0 allocation size. When file is extended, +set its allocation size to a plausible value until we have a +chance to query the server for it. When the file is cached +this will prevent showing an impossible number of allocated +blocks (like 0). This fixes e.g. xfstests 614 which does + + 1) create a file and set its size to 64K + 2) mmap write 64K to the file + 3) stat -c %b for the file (to query the number of allocated blocks) + +It was failing because we returned 0 blocks. Even though we would +return the correct cached file size, we returned an impossible +allocation size. + +Signed-off-by: Steve French +CC: +Reviewed-by: Aurelien Aptel +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/inode.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/fs/cifs/inode.c ++++ b/fs/cifs/inode.c +@@ -2375,7 +2375,7 @@ int cifs_getattr(const struct path *path + * We need to be sure that all dirty pages are written and the server + * has actual ctime, mtime and file length. + */ +- if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE)) && ++ if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE | STATX_BLOCKS)) && + !CIFS_CACHE_READ(CIFS_I(inode)) && + inode->i_mapping && inode->i_mapping->nrpages != 0) { + rc = filemap_fdatawait(inode->i_mapping); +@@ -2565,6 +2565,14 @@ set_size_out: + if (rc == 0) { + cifsInode->server_eof = attrs->ia_size; + cifs_setsize(inode, attrs->ia_size); ++ /* ++ * i_blocks is not related to (i_size / i_blksize), but instead ++ * 512 byte (2**9) size is required for calculating num blocks. ++ * Until we can query the server for actual allocation size, ++ * this is best estimate we have for blocks allocated for a file ++ * Number of blocks must be rounded up so size 1 is not 0 blocks ++ */ ++ inode->i_blocks = (512 - 1 + attrs->ia_size) >> 9; + + /* + * The man page of truncate says if the size changed, diff --git a/queue-5.10/riscv-correct-sparsemem-configuration.patch b/queue-5.10/riscv-correct-sparsemem-configuration.patch new file mode 100644 index 00000000000..b6ee4d965c0 --- /dev/null +++ b/queue-5.10/riscv-correct-sparsemem-configuration.patch @@ -0,0 +1,42 @@ +From a5406a7ff56e63376c210b06072aa0ef23473366 Mon Sep 17 00:00:00 2001 +From: Kefeng Wang +Date: Mon, 15 Mar 2021 20:03:07 +0800 +Subject: riscv: Correct SPARSEMEM configuration + +From: Kefeng Wang + +commit a5406a7ff56e63376c210b06072aa0ef23473366 upstream. + +There are two issues for RV32, +1) if use FLATMEM, it is useless to enable SPARSEMEM_STATIC. +2) if use SPARSMEM, both SPARSEMEM_VMEMMAP and SPARSEMEM_STATIC is enabled. + +Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem") +Signed-off-by: Kefeng Wang +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/riscv/Kconfig ++++ b/arch/riscv/Kconfig +@@ -84,7 +84,6 @@ config RISCV + select PCI_MSI if PCI + select RISCV_INTC + select RISCV_TIMER if RISCV_SBI +- select SPARSEMEM_STATIC if 32BIT + select SPARSE_IRQ + select SYSCTL_EXCEPTION_TRACE + select THREAD_INFO_IN_TASK +@@ -145,7 +144,8 @@ config ARCH_FLATMEM_ENABLE + config ARCH_SPARSEMEM_ENABLE + def_bool y + depends on MMU +- select SPARSEMEM_VMEMMAP_ENABLE ++ select SPARSEMEM_STATIC if 32BIT && SPARSMEM ++ select SPARSEMEM_VMEMMAP_ENABLE if 64BIT + + config ARCH_SELECT_MEMORY_MODEL + def_bool ARCH_SPARSEMEM_ENABLE diff --git a/queue-5.10/series b/queue-5.10/series index 6fdd571f69c..e2d606d78f8 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -51,3 +51,5 @@ pstore-fix-warning-in-pstore_kill_sb.patch io_uring-ensure-that-sqpoll-thread-is-started-for-exit.patch net-qrtr-fix-__netdev_alloc_skb-call.patch kbuild-fix-linux-version.h-for-empty-sublevel-or-patchlevel-again.patch +cifs-fix-allocation-size-on-newly-created-files.patch +riscv-correct-sparsemem-configuration.patch