Skip to contentSkip to conversation

aio: intialize kiocb private

PATCH In review [email protected] 4 participants 7 messages Feb 5, 2019 – Feb 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover aio: intialize kiocb private

From: Mike Marshall <[email protected]>

"aio: don't zero entire aio_kiocb aio_get_req" triggered these BUG_ONs in orangefs file.c. Obviously the BUG_ONs need to go.

There might be other filesystems that use iocb->private without failing in a way that is as obvious as BUG_ON, though I didn't see any with grep.

After discussion on fsdevel, Jens Axboe suggested I should send in a patch that continues to set iocb->private to NULL just in case.

Also... phooey on fighting gmail when trying to send patches with git-send-email... mail.kernel.org works great!

-Mike

#1 lore raw

PATCH 1/2 orangefs: remove two un-needed BUG_ONs...

From: Mike Marshall <[email protected]>

---
 fs/orangefs/file.c | 4 ----
 1 file changed, 4 deletions(-)
fs/orangefs/file.c +0 -4
index a5a2fe76568f..b094d3d79354 100644
@@ -398,8 +398,6 @@ static ssize_t orangefs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter
 	loff_t pos = iocb->ki_pos;
 	ssize_t rc = 0;
 
-	BUG_ON(iocb->private);
-
 	gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_read_iter\n");
 
 	orangefs_stats.reads++;
@@ -416,8 +414,6 @@ static ssize_t orangefs_file_write_iter(struct kiocb *iocb, struct iov_iter *ite
 	loff_t pos;
 	ssize_t rc;
 
-	BUG_ON(iocb->private);
-
 	gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_write_iter\n");
 
 	inode_lock(file->f_mapping->host);
Signature · 1 line
2.20.1
#4 lore raw

PATCH 2/2 aio: initialize kiocb private in case any filesystems expect it.

In reply to [email protected]

From: Mike Marshall <[email protected]>

A recent optimization had left private uninitialized.

---
 fs/aio.c | 1 +
 1 file changed, 1 insertion(+)
fs/aio.c +1 -0
index b906ff70c90f..aaaaf4d12c73 100644
@@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb)
 	if (unlikely(!req->ki_filp))
 		return -EBADF;
 	req->ki_complete = aio_complete_rw;
+	req->private = NULL;
 	req->ki_pos = iocb->aio_offset;
 	req->ki_flags = iocb_flags(req->ki_filp);
 	if (iocb->aio_flags & IOCB_FLAG_RESFD)
Signature · 1 line
2.20.1
maintainer
#3 lore raw

Re: [PATCH 1/2] orangefs: remove two un-needed BUG_ONs...

In reply to Christoph Hellwig

Yes, but I don't think they should be there. You put them into pvfs2_file_aio_read_iovec way back when (Martin guesses you were making sure that you had fully eradicated private's use) and I left them in when I changed that function over to pvfs2_file_read_iter. After that, they've just gone along for the ride... BUG_ONs that the maintainer can't justify might be the kind of thing that would make Linus violate the new code of conduct :-) ...

-Mike

Quoted 2 lines · Christoph Hellwig

Didn't these catch the issue you fix in patch 2?

#6 lore raw
In reply to [email protected]
Quoted 9 lines · On 2/5/19 12:13 PM, [email protected] wrote:

From: Mike Marshall <[email protected]>

"aio: don't zero entire aio_kiocb aio_get_req" triggered these BUG_ONs in orangefs file.c. Obviously the BUG_ONs need to go.

There might be other filesystems that use iocb->private without failing in a way that is as obvious as BUG_ON, though I didn't see any with grep.

Quoted 5 lines

After discussion on fsdevel, Jens Axboe suggested I should send in a patch that continues to set iocb->private to NULL just in case.

Also... phooey on fighting gmail when trying to send patches with git-send-email... mail.kernel.org works great!

Applied 1/2, 2/2 should probably just go in separately with other orangefs patches, when appropriate.

Signature · 1 line
Jens Axboe