[wrecked] fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: fs: return EAGAIN when O_NONBLOCK write should block on frozen fs
has been removed from the -mm tree.  Its filename was
     fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs.patch

This patch was dropped because other changes were merged, which wrecked this patch

------------------------------------------------------
From: Jan Kara <jack@xxxxxxx>
Subject: fs: return EAGAIN when O_NONBLOCK write should block on frozen fs

When user asks for O_NONBLOCK behavior for a file descriptor, return
EAGAIN instead of blocking on a frozen filesystem.

This is needed so we can fix a hang with BSD accounting on frozen
filesystems.

Signed-off-by: Jan Kara <jack@xxxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Acked-by: Joel Becker <jlbec@xxxxxxxxxxxx>
Cc: Mark Fasheh <mfasheh@xxxxxxxx>
Cc: Nikola Ciprich <nikola.ciprich@xxxxxxxxxxx>
Cc: Marco Stornelli <marco.stornelli@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/btrfs/file.c    |    3 ++-
 fs/cifs/file.c     |    3 ++-
 fs/fuse/file.c     |    3 ++-
 fs/ntfs/file.c     |    3 ++-
 fs/ocfs2/file.c    |    3 ++-
 fs/splice.c        |    3 ++-
 fs/xfs/xfs_file.c  |    3 ++-
 include/linux/fs.h |   10 ++++++++++
 mm/filemap.c       |    3 ++-
 9 files changed, 26 insertions(+), 8 deletions(-)

diff -puN fs/btrfs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/btrfs/file.c
--- a/fs/btrfs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/btrfs/file.c
@@ -1514,7 +1514,8 @@ static ssize_t btrfs_file_aio_write(stru
 	size_t count, ocount;
 	bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host);
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 
 	mutex_lock(&inode->i_mutex);
 
diff -puN fs/cifs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/cifs/file.c
--- a/fs/cifs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/cifs/file.c
@@ -2515,7 +2515,8 @@ cifs_writev(struct kiocb *iocb, const st
 
 	BUG_ON(iocb->ki_pos != pos);
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 
 	/*
 	 * We need to hold the sem to be sure nobody modifies lock list
diff -puN fs/fuse/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/fuse/file.c
--- a/fs/fuse/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/fuse/file.c
@@ -971,7 +971,8 @@ static ssize_t fuse_file_aio_write(struc
 		return err;
 
 	count = ocount;
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 	mutex_lock(&inode->i_mutex);
 
 	/* We can write back this queue in page reclaim */
diff -puN fs/ntfs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/ntfs/file.c
--- a/fs/ntfs/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/ntfs/file.c
@@ -2129,7 +2129,8 @@ static ssize_t ntfs_file_aio_write(struc
 
 	BUG_ON(iocb->ki_pos != pos);
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 	mutex_lock(&inode->i_mutex);
 	ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos);
 	mutex_unlock(&inode->i_mutex);
diff -puN fs/ocfs2/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/ocfs2/file.c
--- a/fs/ocfs2/file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/ocfs2/file.c
@@ -2248,7 +2248,8 @@ static ssize_t ocfs2_file_aio_write(stru
 	if (iocb->ki_left == 0)
 		return 0;
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 
 	appending = file->f_flags & O_APPEND ? 1 : 0;
 	direct_io = file->f_flags & O_DIRECT ? 1 : 0;
diff -puN fs/splice.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/splice.c
--- a/fs/splice.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/splice.c
@@ -1001,7 +1001,8 @@ generic_file_splice_write(struct pipe_in
 	};
 	ssize_t ret;
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(out))
+		return -EAGAIN;
 
 	pipe_lock(pipe);
 
diff -puN fs/xfs/xfs_file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs fs/xfs/xfs_file.c
--- a/fs/xfs/xfs_file.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/fs/xfs/xfs_file.c
@@ -775,7 +775,8 @@ xfs_file_aio_write(
 	if (ocount == 0)
 		return 0;
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 
 	if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
 		ret = -EIO;
diff -puN include/linux/fs.h~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs include/linux/fs.h
--- a/include/linux/fs.h~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/include/linux/fs.h
@@ -1400,6 +1400,16 @@ static inline int sb_start_write_trylock
 	return __sb_start_write(sb, SB_FREEZE_WRITE, false);
 }
 
+/*
+ * sb_start_write() for writing into a file. When file has O_NONBLOCK set,
+ * we use trylock semantics, otherwise we block on frozen filesystem.
+ */
+static inline int sb_start_file_write(struct file *file)
+{
+	return __sb_start_write(file->f_mapping->host->i_sb, SB_FREEZE_WRITE,
+				!(file->f_flags & O_NONBLOCK));
+}
+
 /**
  * sb_start_pagefault - get write access to a superblock from a page fault
  * @sb: the super we write to
diff -puN mm/filemap.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs mm/filemap.c
--- a/mm/filemap.c~fs-return-eagain-when-o_nonblock-write-should-block-on-frozen-fs
+++ a/mm/filemap.c
@@ -2528,7 +2528,8 @@ ssize_t generic_file_aio_write(struct ki
 
 	BUG_ON(iocb->ki_pos != pos);
 
-	sb_start_write(inode->i_sb);
+	if (!sb_start_file_write(file))
+		return -EAGAIN;
 	mutex_lock(&inode->i_mutex);
 	ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
 	mutex_unlock(&inode->i_mutex);
_

Patches currently in -mm which might be from jack@xxxxxxx are

linux-next.patch
fs-fix-hang-with-bsd-accounting-on-frozen-filesystem.patch
ocfs2-add-freeze-protection-to-ocfs2_file_splice_write.patch
direct-io-fix-boundary-block-handling.patch
mm-make-snapshotting-pages-for-stable-writes-a-per-bio-operation.patch
mm-make-snapshotting-pages-for-stable-writes-a-per-bio-operation-fix.patch
mm-make-snapshotting-pages-for-stable-writes-a-per-bio-operation-fix-fix.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux