Skip to contentSkip to conversation

nilfs2: double bio_put() in nilfs_end_bio_write()

RFC In review Dan Carpenter 2 participants 4 messages Jul 19, 2013 – Jul 21, 2013

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

RFC 1/1 nilfs2: double bio_put() in nilfs_end_bio_write()

I don't know if this is correct or not, but if feels like we shouldn't be calling bio_put() twice in nilfs_end_bio_write(). Also the comment is out of date. If this is correct then I can resend with a proper Signed-off-by line and everything.

fs/nilfs2/segbuf.c +2 -1
index dc9a913..a660fd7 100644
@@ -346,7 +346,8 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
 	if (err = -EOPNOTSUPP) {
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
 		bio_put(bio);
-		/* to be detected by submit_seg_bio() */
+		/* to be detected by nilfs_segbuf_submit_bio() */
+		return;
 	}
 
 	if (!uptodate)
#1 lore raw

Hi Dan,

Quoted 5 lines · Dan Carpenter

I don't know if this is correct or not, but if feels like we shouldn't be calling bio_put() twice in nilfs_end_bio_write(). Also the comment is out of date. If this is correct then I can resend with a proper Signed-off-by line and everything.

I think that you have caught the important issue.

fs/nilfs2/segbuf.c static void nilfs_end_bio_write(struct bio *bio, int err) · line 350

Quoted 11 lines
fs/nilfs2/segbuf.c +2 -1
index dc9a913..a660fd7 100644
@@ -346,7 +346,8 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
 	if (err = -EOPNOTSUPP) {
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
 		bio_put(bio);
-		/* to be detected by submit_seg_bio() */
+		/* to be detected by nilfs_segbuf_submit_bio() */
+		return;

I think that simple return from the function is not right way. As I understand the code, then we increment error count in segbuf's sb_err field and signalize about completion of operation. So, from my viewpoint, it needs to remove the bio_put() call for the case of (err = -EOPNOTSUPP) instead of return from function.

Thanks,
Vyacheslav Dubeyko.

Quoted 7 lines
fs/nilfs2/segbuf.c +0 -1
 	}
 
 	if (!uptodate)
--

To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Dan Carpenter
Quoted 8 lines · Vyacheslav Dubeyko
Quoted 8 lines
fs/nilfs2/segbuf.c +0 -0
index dc9a913..a660fd7 100644
@@ -346,7 +346,8 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
 	if (err = -EOPNOTSUPP) {
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
 		bio_put(bio);
Quoted 9 lines

fs/nilfs2/segbuf.c static void nilfs_end_bio_write(struct bio *bio, int err) · line 350

Quoted 3 lines
fs/nilfs2/segbuf.c +2 -1
-		/* to be detected by submit_seg_bio() */
+		/* to be detected by nilfs_segbuf_submit_bio() */
+		return;

I think that simple return from the function is not right way. As I understand the code, then we increment error count in segbuf's sb_err field and signalize about completion of operation. So, from my viewpoint, it needs to remove the bio_put() call for the case of (err = -EOPNOTSUPP) instead of return from function.

Do you think you could send that patch and give me a reported-by tag? I feel weird signing off on it when I don't really understand this code...

regards,
dan carpenter

#3 lore raw
In reply to Dan Carpenter
Quoted 19 lines · Dan Carpenter
Quoted 8 lines · Vyacheslav Dubeyko
Quoted 8 lines
fs/nilfs2/segbuf.c +0 -0
index dc9a913..a660fd7 100644
@@ -346,7 +346,8 @@ static void nilfs_end_bio_write(struct bio *bio, int err)
 	if (err = -EOPNOTSUPP) {
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
 		bio_put(bio);
Quoted 9 lines

fs/nilfs2/segbuf.c static void nilfs_end_bio_write(struct bio *bio, int err) · line 350

Quoted 3 lines
fs/nilfs2/segbuf.c +2 -1
-		/* to be detected by submit_seg_bio() */
+		/* to be detected by nilfs_segbuf_submit_bio() */
+		return;

I think that simple return from the function is not right way. As I understand the code, then we increment error count in segbuf's sb_err field and signalize about completion of operation. So, from my viewpoint, it needs to remove the bio_put() call for the case of (err = -EOPNOTSUPP) instead of return from function.

Quoted 4 lines

Do you think you could send that patch and give me a reported-by tag? I feel weird signing off on it when I don't really understand this code...

Ok, sure. I'll send the patch and continue discussion with Ryusuke (if he will have objections).

Thank you for the report and fix suggestion.

With the best regards,
Vyacheslav Dubeyko.

Quoted 2 lines

regards,
dan carpenter