udf: Do not mark possibly inconsistent filesystems as closed
Subsystems (2)
Jan Kara
reviewerPATCH 1/1 udf: Do not mark possibly inconsistent filesystems as closed
If logical volume integrity descriptor contains non-closed integrity type when mounting the volume, there are high chances that the volume is not consistent (device was detached before the filesystem was unmounted). Warn when mounting such volume and don't touch integrity type of the volume so that fsck can recognize it and check such filesystem.
--- fs/udf/super.c | 8 ++++++-- fs/udf/udf_sb.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
fs/udf/super.c +6 -2
@@ -1988,7 +1988,10 @@ static void udf_open_lvid(struct super_block *sb) lvidiu->impIdent.identSuffix[1 ] =UDF_OS_ID_LINUX ;ktime_get_real_ts (&ts);udf_time_to_disk_stamp (&lvid->recordingDateAndTime, ts); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +if (le32_to_cpu (lvid->integrityType) ==LVID_INTEGRITY_TYPE_CLOSE ) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +else +UDF_SET_FLAG (sb,UDF_FLAG_INCONSISTENT ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),
@@ -2028,7 +2031,8 @@ static void udf_close_lvid(struct super_block *sb) lvidiu->minUDFReadRev =cpu_to_le16 (sbi->s_udfrev);if (sbi->s_udfrev >le16_to_cpu (lvidiu->minUDFWriteRev)) lvidiu->minUDFWriteRev =cpu_to_le16 (sbi->s_udfrev); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); +if (!UDF_QUERY_FLAG (sb,UDF_FLAG_INCONSISTENT )) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),
fs/udf/udf_sb.h +1 -0
@@ -29,6 +29,7 @@#define UDF_FLAG_SESSION_SET 15#define UDF_FLAG_LASTBLOCK_SET 16#define UDF_FLAG_BLOCKSIZE_SET 17 +#define UDF_FLAG_INCONSISTENT 18#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
Signature · 1 line
2.13.6
Quoted 4 lines · On Wednesday 28 February 2018 12:22:55 Jan Kara wrote:
If logical volume integrity descriptor contains non-closed integrity type when mounting the volume, there are high chances that the volume is not consistent (device was detached before the filesystem was unmounted). Warn when mounting such volume and don't touch integrity
Need to edit commit message as there is no warning in patch...
Quoted 47 lines
type of the volume so that fsck can recognize it and check such filesystem.
Signed-off-by Jan Kara <[email protected]>--- fs/udf/super.c | 8 ++++++-- fs/udf/udf_sb.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)fs/udf/super.c +6
-2@@ -1988,7 +1988,10 @@ static void udf_open_lvid(struct super_block *sb) lvidiu->impIdent.identSuffix[1 ] =UDF_OS_ID_LINUX ;ktime_get_real_ts (&ts);udf_time_to_disk_stamp (&lvid->recordingDateAndTime, ts); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +if (le32_to_cpu (lvid->integrityType) ==LVID_INTEGRITY_TYPE_CLOSE ) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +else +UDF_SET_FLAG (sb,UDF_FLAG_INCONSISTENT ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),@@ -2028,7 +2031,8 @@ static void udf_close_lvid(struct super_block *sb) lvidiu->minUDFReadRev =cpu_to_le16 (sbi->s_udfrev);if (sbi->s_udfrev >le16_to_cpu (lvidiu->minUDFWriteRev)) lvidiu->minUDFWriteRev =cpu_to_le16 (sbi->s_udfrev); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); +if (!UDF_QUERY_FLAG (sb,UDF_FLAG_INCONSISTENT )) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),fs/udf/udf_sb.h +1
-0@@ -29,6 +29,7 @@#define UDF_FLAG_SESSION_SET 15#define UDF_FLAG_LASTBLOCK_SET 16#define UDF_FLAG_BLOCKSIZE_SET 17 +#define UDF_FLAG_INCONSISTENT 18#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
Signature · 2 lines
Pali Rohár [email protected]
Jan Kara
reviewerQuoted 7 lines · Pali Roh�r
Quoted 4 lines · On Wednesday 28 February 2018 12:22:55 Jan Kara wrote:
If logical volume integrity descriptor contains non-closed integrity type when mounting the volume, there are high chances that the volume is not consistent (device was detached before the filesystem was unmounted). Warn when mounting such volume and don't touch integrity
Need to edit commit message as there is no warning in patch...
Good point. Fixed and pushed to my tree. Can I add your Reviewed-by tag?
Honza
Quoted 52 lines
Quoted 48 lines
type of the volume so that fsck can recognize it and check such filesystem.
Signed-off-by Jan Kara <[email protected]>--- fs/udf/super.c | 8 ++++++-- fs/udf/udf_sb.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)fs/udf/super.c +6
-2@@ -1988,7 +1988,10 @@ static void udf_open_lvid(struct super_block *sb) lvidiu->impIdent.identSuffix[1 ] =UDF_OS_ID_LINUX ;ktime_get_real_ts (&ts);udf_time_to_disk_stamp (&lvid->recordingDateAndTime, ts); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +if (le32_to_cpu (lvid->integrityType) ==LVID_INTEGRITY_TYPE_CLOSE ) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_OPEN ); +else +UDF_SET_FLAG (sb,UDF_FLAG_INCONSISTENT ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),@@ -2028,7 +2031,8 @@ static void udf_close_lvid(struct super_block *sb) lvidiu->minUDFReadRev =cpu_to_le16 (sbi->s_udfrev);if (sbi->s_udfrev >le16_to_cpu (lvidiu->minUDFWriteRev)) lvidiu->minUDFWriteRev =cpu_to_le16 (sbi->s_udfrev); - lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); +if (!UDF_QUERY_FLAG (sb,UDF_FLAG_INCONSISTENT )) + lvid->integrityType =cpu_to_le32 (LVID_INTEGRITY_TYPE_CLOSE ); lvid->descTag.descCRC = cpu_to_le16( crc_itu_t(0, (char *)lvid + sizeof(struct tag),fs/udf/udf_sb.h +1
-0@@ -29,6 +29,7 @@#define UDF_FLAG_SESSION_SET 15#define UDF_FLAG_LASTBLOCK_SET 16#define UDF_FLAG_BLOCKSIZE_SET 17 +#define UDF_FLAG_INCONSISTENT 18#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002Signature · 2 lines
Pali Roh�r [email protected]
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 10 lines · On Thursday 01 March 2018 13:33:08 Jan Kara wrote:
Quoted 7 lines · Pali Rohár
Quoted 4 lines · On Wednesday 28 February 2018 12:22:55 Jan Kara wrote:
If logical volume integrity descriptor contains non-closed integrity type when mounting the volume, there are high chances that the volume is not consistent (device was detached before the filesystem was unmounted). Warn when mounting such volume and don't touch integrity
Need to edit commit message as there is no warning in patch...
Good point. Fixed and pushed to my tree. Can I add your Reviewed-by tag?
Yes!
Signature · 2 lines
Pali Rohár [email protected]