From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
To: Jan Kara <jack@suse.cz>
Cc: jack@suse.com, linux-ext4@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
tytso@mit.edu, mhocko@suse.cz, linux-mm@kvack.org,
syzbot <syzbot+bfdded10ab7dcd7507ae@syzkaller.appspotmail.com>
Subject: Re: possible deadlock in start_this_handle (2)
Date: Sat, 13 Feb 2021 23:26:37 +0900 [thread overview]
Message-ID: <bf1088e3-b051-6361-57dd-6b836b1c3b46@i-love.sakura.ne.jp> (raw)
In-Reply-To: <20210211104947.GL19070@quack2.suse.cz>
On 2021/02/11 19:49, Jan Kara wrote:
> This stacktrace should never happen. ext4_xattr_set() starts a transaction.
> That internally goes through start_this_handle() which calls:
>
> handle->saved_alloc_context = memalloc_nofs_save();
>
> and we restore the allocation context only in stop_this_handle() when
> stopping the handle. And with this fs_reclaim_acquire() should remove
> __GFP_FS from the mask and not call __fs_reclaim_acquire().
Excuse me, but it seems to me that nothing prevents ext4_xattr_set_handle() from reaching
ext4_xattr_inode_lookup_create() without memalloc_nofs_save() when hitting ext4_get_nojournal() path.
Will you explain when ext4_get_nojournal() path is executed?
ext4_xattr_set() {
handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits) == __ext4_journal_start() {
return __ext4_journal_start_sb() {
journal = EXT4_SB(sb)->s_journal;
if (!journal || (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY))
return ext4_get_nojournal(); // Never calls memalloc_nofs_save() despite returning !IS_ERR() value.
return jbd2__journal_start(journal, blocks, rsv_blocks, revoke_creds, GFP_NOFS, type, line); // Calls memalloc_nofs_save() when start_this_handle() returns 0.
}
}
}
error = ext4_xattr_set_handle(handle, inode, name_index, name, value, value_len, flags); {
ext4_write_lock_xattr(inode, &no_expand); // Grabs &ei->xattr_sem
error = ext4_xattr_ibody_set(handle, inode, &i, &is) {
error = ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */) {
ret = ext4_xattr_inode_lookup_create(handle, inode, i->value, i->value_len, &new_ea_inode); // Using GFP_KERNEL based on assumption that ext4_journal_start() called memalloc_nofs_save().
}
}
}
}
next prev parent reply other threads:[~2021-02-13 14:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <000000000000563a0205bafb7970@google.com>
2021-02-11 10:49 ` possible deadlock in start_this_handle (2) Jan Kara
2021-02-11 10:55 ` Michal Hocko
2021-02-11 11:22 ` Dmitry Vyukov
2021-02-11 11:28 ` Dmitry Vyukov
2021-02-11 12:10 ` Jan Kara
2021-02-11 12:34 ` Michal Hocko
2021-02-11 12:57 ` Matthew Wilcox
2021-02-11 13:07 ` Michal Hocko
2021-02-11 13:25 ` Matthew Wilcox
2021-02-11 14:20 ` Michal Hocko
2021-02-11 14:26 ` Matthew Wilcox
2021-02-11 16:41 ` Michal Hocko
2021-02-12 11:18 ` Tetsuo Handa
2021-02-12 12:22 ` Matthew Wilcox
2021-02-12 12:30 ` Michal Hocko
2021-02-12 12:58 ` Tetsuo Handa
2021-02-12 13:12 ` Michal Hocko
2021-02-12 13:34 ` Tetsuo Handa
2021-02-12 15:43 ` Michal Hocko
2021-02-13 10:58 ` Dmitry Vyukov
2021-02-11 13:18 ` Dmitry Vyukov
2021-02-11 11:46 ` Jan Kara
2021-02-13 14:26 ` Tetsuo Handa [this message]
2021-02-15 12:45 ` Jan Kara
2021-02-15 14:06 ` Tetsuo Handa
2021-02-15 14:29 ` Jan Kara
2021-02-19 10:15 ` Tetsuo Handa
2021-02-19 17:22 ` harshad shirwadkar
2021-03-20 10:02 ` Tetsuo Handa
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=bf1088e3-b051-6361-57dd-6b836b1c3b46@i-love.sakura.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=syzbot+bfdded10ab7dcd7507ae@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tytso@mit.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).