Skip to contentSkip to conversation

UBIFS: make space fixup work in the remount case

DISCUSSION Artem Bityutskiy 2 participants 5 messages Apr 15, 2013 – Apr 7, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#2 lore raw
Quoted 8 lines · Artem Bityutskiy
Quoted 6 lines · Dan Carpenter

1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)

  1574                          return err;
                                ^^^^^^^^^^

Shouldn't this be a "goto out?". We're holding the c->umount_mutex.

Quoted 4 lines

Hi Dan, I fixed this up and answered the reporter:
https://patchwork.kernel.org/patch/2284681/

It is now 'goto out'. Thanks!

Huh... That wasn't who I expected to report it. :P It's good to know that these kind of bugs don't last very long.

regards,
dan carpenter

#3 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 8 lines · Artem Bityutskiy
Quoted 6 lines · Dan Carpenter

1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)

  1574                          return err;
                                ^^^^^^^^^^

Shouldn't this be a "goto out?". We're holding the c->umount_mutex.

Quoted 7 lines
Quoted 4 lines

Hi Dan, I fixed this up and answered the reporter:
https://patchwork.kernel.org/patch/2284681/

It is now 'goto out'. Thanks!

Huh... That wasn't who I expected to report it. :P It's good to know that these kind of bugs don't last very long.

The story actually was that I noticed this myself after running Aiaiai and fixed it up "in-place", and then several people reported, and I answered to one of them.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#4 lore raw
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Dan Carpenter
Quoted 11 lines · Artem Bityutskiy
Quoted 6 lines · Dan Carpenter

1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)

  1574                          return err;
                                ^^^^^^^^^^

Shouldn't this be a "goto out?". We're holding the c->umount_mutex.

Hi Dan, I fixed this up and answered the reporter:
https://patchwork.kernel.org/patch/2284681/

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It is now 'goto out'. Thanks!

Huh... That wasn't who I expected to report it. :P It's good to know that these kind of bugs don't last very long.

The story actually was that I noticed this myself after running Aiaiai and fixed it up "in-place", and then several people reported, and I answered to one of them.

Hi Artem,

This showed up in my smatch output again today. Whatever happened with this. I reported it last Jun and last Nov as well apparently.

regards,
dan carpenter

#5 lore raw
Quoted 19 lines · Dan Carpenter
Quoted 18 lines · Artem Bityutskiy
Quoted 16 lines · Dan Carpenter
Quoted 8 lines · Artem Bityutskiy
Quoted 6 lines · Dan Carpenter

1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)

  1574                          return err;
                                ^^^^^^^^^^

Shouldn't this be a "goto out?". We're holding the c->umount_mutex.

Quoted 4 lines

Hi Dan, I fixed this up and answered the reporter:
https://patchwork.kernel.org/patch/2284681/

It is now 'goto out'. Thanks!

Huh... That wasn't who I expected to report it. :P It's good to know that these kind of bugs don't last very long.

Quoted 8 lines
Quoted 3 lines

The story actually was that I noticed this myself after running Aiaiai and fixed it up "in-place", and then several people reported, and I answered to one of them.

Hi Artem,

This showed up in my smatch output again today. Whatever happened with this. I reported it last Jun and last Nov as well apparently.

Hmm, I was sure I fixed this, but it is still there.

OK, created and pushed a fix to the master branch. It won't hit linux-next so far, I'll propagate it there once 3.15-rc1 or -rc2 is out. Thanks!

From: Artem Bityutskiy <[email protected]>
Date: Mon, 7 Apr 2014 13:39:06 +0300
Subject: [PATCH] UBIFS: fix remount error path

Dan's "smatch" checker found out that there was a bug in the error path of the 'ubifs_remount_rw()' function. Instead of jumping to the "out" label which cleans-things up, we just returned.

This patch fixes the problem.

---
 fs/ubifs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/super.c +1 -1
index 5ded849..7e71ac9 100644
@@ -1556,7 +1556,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
        if (c->space_fixup) {
                err = ubifs_fixup_free_space(c);
                if (err)
-                       return err;
+                       goto out;
        }
 
        err = check_free_space(c);
Signature · 5 lines
1.8.5.3

-- 
Best Regards,
Artem Bityutskiy