]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
liblkid: fix probe_nilfs2 I/O error backup
authorKarel Zak <kzak@redhat.com>
Fri, 15 Jul 2016 08:39:20 +0000 (10:39 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Aug 2016 11:11:02 +0000 (13:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/nilfs.c

index cd93d7bc5bfbd313145e70dcc5914e8376133a9e..ab0f74c23f6d7a516878808db45c45e3c11d4b1e 100644 (file)
@@ -109,18 +109,29 @@ static int probe_nilfs2(blkid_probe pr,
        if (!sbp)
                return errno ? -errno : 1;
 
+       valid[0] = nilfs_valid_sb(pr, sbp, 0);
+
+
        /* backup */
        sbb = (struct nilfs_super_block *) blkid_probe_get_buffer(
                        pr, NILFS_SBB_OFFSET(pr->size), sizeof(struct nilfs_super_block));
-       if (!sbb)
-               return errno ? -errno : 1;
+       if (!sbb) {
+               valid[1] = 0;
+
+               /* If the primary block is valid then continue and ignore also
+                * I/O errors for backup block. Note the this is probably CD
+                * where I/O errors and the end of the disk/session are "normal".
+                */
+               if (!valid[0])
+                       return errno ? -errno : 1;
+       } else
+               valid[1] = nilfs_valid_sb(pr, sbb, 1);
+
 
        /*
         * Compare two super blocks and set 1 in swp if the secondary
         * super block is valid and newer.  Otherwise, set 0 in swp.
         */
-       valid[0] = nilfs_valid_sb(pr, sbp, 0);
-       valid[1] = nilfs_valid_sb(pr, sbb, 1);
        if (!valid[0] && !valid[1])
                return 1;