summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks
diff options
context:
space:
mode:
authorKarel Zak2016-07-15 10:39:20 +0200
committerKarel Zak2016-08-02 15:54:13 +0200
commit38f6945d63f3e233996af8ccec179168afb5a8e5 (patch)
tree7d949328167b61658528c17e1cb526a5c50fc8b2 /libblkid/src/superblocks
parentMerge branch 'oclint' of git://github.com/kerolasa/lelux-utiliteetit (diff)
downloadkernel-qcow2-util-linux-38f6945d63f3e233996af8ccec179168afb5a8e5.tar.gz
kernel-qcow2-util-linux-38f6945d63f3e233996af8ccec179168afb5a8e5.tar.xz
kernel-qcow2-util-linux-38f6945d63f3e233996af8ccec179168afb5a8e5.zip
liblkid: fix probe_nilfs2 I/O error backup
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/superblocks')
-rw-r--r--libblkid/src/superblocks/nilfs.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libblkid/src/superblocks/nilfs.c b/libblkid/src/superblocks/nilfs.c
index cd93d7bc5..ab0f74c23 100644
--- a/libblkid/src/superblocks/nilfs.c
+++ b/libblkid/src/superblocks/nilfs.c
@@ -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;