f2fs: set SBI_NEED_FSCK flag when inconsistent node block found
Subsystems (4)
Sasha Levin
maintainerPATCH 1/4 f2fs: set SBI_NEED_FSCK flag when inconsistent node block found
From: Weichao Guo <[email protected]>
[ Upstream commit 6663b138ded1a59e630c9e605e42aa7fde490cdc ]
Inconsistent node block will cause a file fail to open or read, which could make the user process crashes or stucks. Let's mark SBI_NEED_FSCK flag to trigger a fix at next fsck time. After unlinking the corrupted file, the user process could regenerate a new one and work correctly.
--- fs/f2fs/node.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/node.c +1 -0
@@ -1389,6 +1389,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, nid,nid_of_node (page),ino_of_node (page),ofs_of_node (page),cpver_of_node (page), next_blkaddr_of_node(page)); +set_sbi_flag (sbi,SBI_NEED_FSCK ); err = -EINVAL ; out_err:ClearPageUptodate (page);
Signature · 8 lines
2.33.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 2/4 ceph: properly handle statfs on multifs setups
From: Jeff Layton <[email protected]>
[ Upstream commit 8cfc0c7ed34f7929ce7e5d7c6eecf4d01ba89a84 ]
ceph_statfs currently stuffs the cluster fsid into the f_fsid field. This was fine when we only had a single filesystem per cluster, but now that we have multiples we need to use something that will vary between them.
Change ceph_statfs to xor each 32-bit chunk of the fsid (aka cluster id) into the lower bits of the statfs->f_fsid. Change the lower bits to hold the fscid (filesystem ID within the cluster).
That should give us a value that is guaranteed to be unique between filesystems within a cluster, and should minimize the chance of collisions between mounts of different clusters.
URL: https://tracker.ceph.com/issues/52812
--- fs/ceph/super.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/ceph/super.c +6 -5
@@ -52,8 +52,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)struct ceph_fs_client *fsc =ceph_inode_to_client (d_inode (dentry));struct ceph_mon_client *monc = &fsc->client->monc;struct ceph_statfs st; -u64 fsid; -int err; +int i, err;u64 data_pool;if (fsc->mdsc->mdsmap->m_num_data_pg_pools ==1 ) {
@@ -99,12 +98,14 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_namelen =NAME_MAX ;/* Must convert the fsid, for consistent values across arches */ + buf->f_fsid.val[0 ] =0 ;mutex_lock (&monc->mutex); - fsid =le64_to_cpu (*(__le64 *)(&monc->monmap->fsid)) ^ -le64_to_cpu (*((__le64 *)&monc->monmap->fsid +1 )); +for (i =0 ; i <sizeof (monc->monmap->fsid) /sizeof (__le32) ; ++i) + buf->f_fsid.val[0 ] ^=le32_to_cpu (((__le32 *)&monc->monmap->fsid)[i]);mutex_unlock (&monc->mutex); - buf->f_fsid =u64_to_fsid (fsid); +/* fold the fs_cluster_id into the upper bits */ + buf->f_fsid.val[1 ] = monc->fs_cluster_id;return 0 ; }
Signature · 1 line
2.33.0
Sasha Levin
maintainerPATCH 3/4 virtio-mem: support VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
[ Upstream commit 61082ad6a6e1f999eef7e7e90046486c87933b1e ]
The initial virtio-mem spec states that while unplugged memory should not be read, the device still has to allow for reading unplugged memory inside the usable region. The primary motivation for this default handling was to simplify bringup of virtio-mem, because there were corner cases where Linux might have accidentially read unplugged memory inside added Linux memory blocks.
In the meantime, we:
1. Removed /dev/kmem in commit bbcd53c96071 ("drivers/char: remove /dev/kmem for good")
2. Disallowed access to virtio-mem device memory via /dev/mem in commit 2128f4e21aa2 ("virtio-mem: disallow mapping virtio-mem memory via /dev/mem")
3. Sanitized access to virtio-mem device memory via /proc/kcore in commit 0daa322b8ff9 ("fs/proc/kcore: don't read offline sections, logically offline pages and hwpoisoned pages")
4. Sanitized access to virtio-mem device memory via /proc/vmcore in commit ce2814622e84 ("virtio-mem: kdump mode to sanitize /proc/vmcore access")
"Accidential" access to unplugged memory is no longer possible; we can support the new VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE feature that will be required by some hypervisors implementing virtio-mem in the near future.
--- drivers/virtio/virtio_mem.c | 1 + include/uapi/linux/virtio_mem.h | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/virtio/virtio_mem.c +1 -0
@@ -1925,6 +1925,7 @@ static unsigned int virtio_mem_features[] = { #if defined(CONFIG_NUMA) && defined(CONFIG_ACPI_NUMA) VIRTIO_MEM_F_ACPI_PXM, #endif + VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, }; static const struct virtio_device_id virtio_mem_id_table[] = {
include/uapi/linux/virtio_mem.h +6 -3
@@ -68,9 +68,10 @@* explicitly triggered (VIRTIO_MEM_REQ_UNPLUG). * * There are no guarantees what will happen if unplugged memory is -* read/written. Such memory should, in general, not be touched. E.g., -* even writing might succeed, but the values will simply be discarded at -* random points in time. +* read/written. In general, unplugged memory should not be touched, because +* the resulting action is undefined. There is one exception: without +* VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, unplugged memory inside the usable +* region can be read, to simplify creation of memory dumps. * * It can happen that the device cannot process a request, because it is * busy. The device driver has to retry later.
@@ -87,6 +88,8 @@/* node_id is an ACPI PXM and is valid */ #define VIRTIO_MEM_F_ACPI_PXM 0 +/* unplugged memory must not be accessed */ +#define VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE 1/* --- virtio-mem: guest -> host requests --- */
Signature · 6 lines
2.33.0 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH AUTOSEL 5.10 3/4] virtio-mem: support VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE
Quoted 11 lines · Sasha Levin
From: David Hildenbrand <[email protected]>
[ Upstream commit
61082ad6a6e1f999eef7e7e90046486c87933b1e]The initial virtio-mem spec states that while unplugged memory should not be read, the device still has to allow for reading unplugged memory inside the usable region. The primary motivation for this default handling was to simplify bringup of virtio-mem, because there were corner cases where Linux might have accidentially read unplugged memory inside added Linux memory blocks.
Quoted 12 lines
In the meantime, we:
1. Removed/dev/kmemin commitbbcd53c96071("drivers/char: remove/dev/kmemfor good")
2. Disallowed access to virtio-mem device memory via/dev/memin commit2128f4e21aa2("virtio-mem: disallow mapping virtio-mem memory via/dev/mem")
3. Sanitized access to virtio-mem device memory via/proc/kcorein commit0daa322b8ff9("fs/proc/kcore: don't read offline sections, logically offline pages and hwpoisoned pages")
4. Sanitized access to virtio-mem device memory via/proc/vmcorein commitce2814622e84("virtio-mem: kdump mode to sanitize/proc/vmcoreaccess")
As 2. and 4. are part of v5.16-rc1 but not v5.10-stable
Signature · 8 lines
Thanks, David / dhildenb _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 4/4 smb3: do not error on fsync when readonly
In reply to Sasha LevinFrom: Steve French <[email protected]>
[ Upstream commit 71e6864eacbef0b2645ca043cdfbac272cb6cea3 ]
Linux allows doing a flush/fsync on a file open for read-only, but the protocol does not allow that. If the file passed in on the flush is read-only try to find a writeable handle for the same inode, if that is not possible skip sending the fsync call to the server to avoid breaking the apps.
--- fs/cifs/file.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
fs/cifs/file.c +29 -6
@@ -2618,12 +2618,23 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, tcon =tlink_tcon (smbfile->tlink);if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NOSSYNC )) { server = tcon->ses->server; -if (server->ops->flush) - rc = server->ops->flush (xid, tcon, &smbfile->fid); -else +if (server->ops->flush ==NULL ) { rc = -ENOSYS ; + goto strict_fsync_exit; + } + +if ((OPEN_FMODE (smbfile->f_flags) &FMODE_WRITE ) ==0 ) { + smbfile =find_writable_file (CIFS_I (inode),FIND_WR_ANY ); +if (smbfile) { + rc = server->ops->flush (xid, tcon, &smbfile->fid); +cifsFileInfo_put (smbfile); + }else +cifs_dbg (FYI ,"ignore fsync for file not open for write\n" ); + }else + rc = server->ops->flush (xid, tcon, &smbfile->fid); } +strict_fsync_exit:free_xid (xid);return rc; }
@@ -2635,6 +2646,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)struct cifs_tcon *tcon;struct TCP_Server_Info *server;struct cifsFileInfo *smbfile = file->private_data; +struct inode *inode =file_inode (file);struct cifs_sb_info *cifs_sb =CIFS_FILE_SB (file); rc =file_write_and_wait_range (file, start, end);
@@ -2651,12 +2663,23 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) tcon =tlink_tcon (smbfile->tlink);if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NOSSYNC )) { server = tcon->ses->server; -if (server->ops->flush) - rc = server->ops->flush (xid, tcon, &smbfile->fid); -else +if (server->ops->flush ==NULL ) { rc = -ENOSYS ; + goto fsync_exit; + } + +if ((OPEN_FMODE (smbfile->f_flags) &FMODE_WRITE ) ==0 ) { + smbfile =find_writable_file (CIFS_I (inode),FIND_WR_ANY ); +if (smbfile) { + rc = server->ops->flush (xid, tcon, &smbfile->fid); +cifsFileInfo_put (smbfile); + }else +cifs_dbg (FYI ,"ignore fsync for file not open for write\n" ); + }else + rc = server->ops->flush (xid, tcon, &smbfile->fid); } +fsync_exit:free_xid (xid);return rc; }
Signature · 1 line
2.33.0