From: Dan Carpenter <dan.carpenter@oracle.com>
To: Namjae Jeon <namjae.jeon@samsung.com>
Cc: linux-ext4@vger.kernel.org
Subject: re: ext4: serialize unaligned asynchronous DIO
Date: Tue, 27 May 2014 17:17:08 +0300 [thread overview]
Message-ID: <20140527141708.GA2842@mwanda> (raw)
Hello Namjae Jeon,
The patch 00532604c72e: "ext4: introduce new i_write_mutex to protect
fallocate" from May 26, 2014, leads to the following static checker
warning:
fs/ext4/file.c:195 ext4_file_write_iter()
warn: 'mutex:&EXT4_Iinode->i_write_mutex' is sometimes locked here and sometimes unlocked.
fs/ext4/file.c
104 mutex_lock(&EXT4_I(inode)->i_write_mutex);
105
106 /*
107 * Unaligned direct AIO must be serialized; see comment above
108 * In the case of O_APPEND, assume that we must always serialize
109 */
110 if (o_direct &&
111 ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) &&
112 !is_sync_kiocb(iocb) &&
113 (file->f_flags & O_APPEND ||
114 ext4_unaligned_aio(inode, from, pos))) {
115 unaligned_direct_aio = true;
116 ext4_unwritten_wait(inode);
117 }
118
119 mutex_lock(&inode->i_mutex);
120 if (file->f_flags & O_APPEND)
121 iocb->ki_pos = pos = i_size_read(inode);
122
123 /*
124 * If we have encountered a bitmap-format file, the size limit
125 * is smaller than s_maxbytes, which is for extent-mapped files.
126 */
127 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
128 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
129
130 if ((pos > sbi->s_bitmap_maxbytes) ||
131 (pos == sbi->s_bitmap_maxbytes && length > 0)) {
132 mutex_unlock(&inode->i_mutex);
133 ret = -EFBIG;
We want to always unlock on this path but it only unlocks when
"unaligned_direct_aio" is true.
134 goto errout;
135 }
136
[ snip ]
192 errout:
193 if (unaligned_direct_aio)
194 mutex_unlock(&EXT4_I(inode)->i_write_mutex);
195 return ret;
196 }
regards,
dan carpenter
next reply other threads:[~2014-05-27 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 14:17 Dan Carpenter [this message]
2014-05-27 15:38 ` ext4: serialize unaligned asynchronous DIO Theodore Ts'o
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=20140527141708.GA2842@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=namjae.jeon@samsung.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.