All of lore.kernel.org
 help / color / mirror / Atom feed
* + vfs-partially-revert-dont-allow-writes-to-swap-files.patch added to -mm tree
@ 2020-03-03 23:48 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-03-03 23:48 UTC (permalink / raw)
  To: darrick.wong, domenico.andreoli, hch, len.brown, mkleinsoft,
	mm-commits, pavel, rjw, viro


The patch titled
     Subject: vfs: partially revert "don't allow writes to swap files"
has been added to the -mm tree.  Its filename is
     vfs-partially-revert-dont-allow-writes-to-swap-files.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/vfs-partially-revert-dont-allow-writes-to-swap-files.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/vfs-partially-revert-dont-allow-writes-to-swap-files.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Darrick J. Wong <darrick.wong@oracle.com>
Subject: vfs: partially revert "don't allow writes to swap files"

In commit dc617f29dbe5 ("vfs: don't allow writes to swap files") we tried
to prevent userspace programs from writing to active swap devices. 
However, it turns out that userspace hibernation requires the ability to
write the hibernation image to a swap device, so revert the write path
checks.

Link: http://lkml.kernel.org/r/20200303191023.GD8037@magnolia
Fixes: dc617f29dbe5 ("vfs: don't allow writes to swap files")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: Domenico Andreoli <domenico.andreoli@linux.com>
Reported-by: Marian Klein <mkleinsoft@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/block_dev.c |    3 ---
 mm/filemap.c   |    3 ---
 mm/memory.c    |    4 ----
 mm/mmap.c      |    8 ++------
 4 files changed, 2 insertions(+), 16 deletions(-)

--- a/fs/block_dev.c~vfs-partially-revert-dont-allow-writes-to-swap-files
+++ a/fs/block_dev.c
@@ -2001,9 +2001,6 @@ ssize_t blkdev_write_iter(struct kiocb *
 	if (bdev_read_only(I_BDEV(bd_inode)))
 		return -EPERM;
 
-	if (IS_SWAPFILE(bd_inode))
-		return -ETXTBSY;
-
 	if (!iov_iter_count(from))
 		return 0;
 
--- a/mm/filemap.c~vfs-partially-revert-dont-allow-writes-to-swap-files
+++ a/mm/filemap.c
@@ -2920,9 +2920,6 @@ inline ssize_t generic_write_checks(stru
 	loff_t count;
 	int ret;
 
-	if (IS_SWAPFILE(inode))
-		return -ETXTBSY;
-
 	if (!iov_iter_count(from))
 		return 0;
 
--- a/mm/memory.c~vfs-partially-revert-dont-allow-writes-to-swap-files
+++ a/mm/memory.c
@@ -2376,10 +2376,6 @@ static vm_fault_t do_page_mkwrite(struct
 
 	vmf->flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE;
 
-	if (vmf->vma->vm_file &&
-	    IS_SWAPFILE(vmf->vma->vm_file->f_mapping->host))
-		return VM_FAULT_SIGBUS;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-03 23:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 23:48 + vfs-partially-revert-dont-allow-writes-to-swap-files.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.