All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: syzbot <syzbot+9331a354f4f624a52a55@syzkaller.appspotmail.com>
Cc: Jiufei Xue <jiufei.xue@linux.alibaba.com>,
	linux-kernel@vger.kernel.org,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Miklos Szeredi <mszeredi@redhat.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: WARNING: lock held when returning to user space in ovl_write_iter
Date: Fri, 13 Mar 2020 09:53:42 +0100	[thread overview]
Message-ID: <CAJfpegtd603jRNKnwFdNw4HffC7nj08YzWOrm3x=mf0ZwHzoOw@mail.gmail.com> (raw)
In-Reply-To: <000000000000cc1faf059fcfdc73@google.com>

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
63623fd4

[-- Attachment #2: ovl-fix-lockdep-warning-for-async-write.patch --]
[-- Type: text/x-patch, Size: 822 bytes --]

---
 fs/overlayfs/file.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -244,6 +244,9 @@ static void ovl_aio_cleanup_handler(stru
 	if (iocb->ki_flags & IOCB_WRITE) {
 		struct inode *inode = file_inode(orig_iocb->ki_filp);
 
+		/* Actually acquired in ovl_write_iter() */
+		__sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb,
+				      SB_FREEZE_WRITE);
 		file_end_write(iocb->ki_filp);
 		ovl_copyattr(ovl_inode_real(inode), inode);
 	}
@@ -346,6 +349,9 @@ static ssize_t ovl_write_iter(struct kio
 			goto out;
 
 		file_start_write(real.file);
+		/* Pacify lockdep, same trick as done in aio_write() */
+		__sb_writers_release(file_inode(real.file)->i_sb,
+				     SB_FREEZE_WRITE);
 		aio_req->fd = real;
 		real.flags = 0;
 		aio_req->orig_iocb = iocb;

      parent reply	other threads:[~2020-03-13  8:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 19:13 WARNING: lock held when returning to user space in ovl_write_iter syzbot
2020-03-12 15:30 ` Miklos Szeredi
2020-03-12 18:35   ` syzbot
2020-03-13  8:53 ` Miklos Szeredi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJfpegtd603jRNKnwFdNw4HffC7nj08YzWOrm3x=mf0ZwHzoOw@mail.gmail.com' \
    --to=miklos@szeredi.hu \
    --cc=jiufei.xue@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=syzbot+9331a354f4f624a52a55@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.