]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Mar 2021 12:13:16 +0000 (13:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Mar 2021 12:13:16 +0000 (13:13 +0100)
added patches:
cifs-fix-allocation-size-on-newly-created-files.patch
riscv-correct-sparsemem-configuration.patch

queue-5.10/cifs-fix-allocation-size-on-newly-created-files.patch [new file with mode: 0644]
queue-5.10/riscv-correct-sparsemem-configuration.patch [new file with mode: 0644]
queue-5.10/series

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 (file)
index 0000000..0798772
--- /dev/null
@@ -0,0 +1,58 @@
+From 65af8f0166f4d15e61c63db498ec7981acdd897f Mon Sep 17 00:00:00 2001
+From: Steve French <stfrench@microsoft.com>
+Date: Fri, 19 Mar 2021 00:05:48 -0500
+Subject: cifs: fix allocation size on newly created files
+
+From: Steve French <stfrench@microsoft.com>
+
+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 <stfrench@microsoft.com>
+CC: <stable@vger.kernel.org>
+Reviewed-by: Aurelien Aptel <aaptel@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 (file)
index 0000000..b6ee4d9
--- /dev/null
@@ -0,0 +1,42 @@
+From a5406a7ff56e63376c210b06072aa0ef23473366 Mon Sep 17 00:00:00 2001
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+Date: Mon, 15 Mar 2021 20:03:07 +0800
+Subject: riscv: Correct SPARSEMEM configuration
+
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+
+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 <wangkefeng.wang@huawei.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
index 6fdd571f69c2f638ed3b16ff487e3d1afb400c56..e2d606d78f89476267bcd466a60291cc63372925 100644 (file)
@@ -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