Skip to content

Commit e0797d3

Browse files
committed
Merge tag 'fs_for_v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull ext2 and isofs updates from Jan Kara: - isofs fix of handling of particularly formatted Rock Ridge timestamps - Add deprecation notice about support of DAX in ext2 filesystem driver * tag 'fs_for_v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: ext2: Deprecate DAX isofs: fix Y2038 and Y2156 issues in Rock Ridge TF entry
2 parents db34015 + d5a2693 commit e0797d3

File tree

6 files changed

+66
-43
lines changed

6 files changed

+66
-43
lines changed

fs/ext2/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
601601
case Opt_dax:
602602
#ifdef CONFIG_FS_DAX
603603
ext2_msg_fc(fc, KERN_WARNING,
604-
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
604+
"DAX enabled. Warning: DAX support in ext2 driver is deprecated"
605+
" and will be removed at the end of 2025. Please use ext4 driver instead.");
605606
ctx_set_mount_opt(ctx, EXT2_MOUNT_DAX);
606607
#else
607608
ext2_msg_fc(fc, KERN_INFO, "dax option not supported");

fs/isofs/inode.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
12751275
unsigned long offset;
12761276
struct iso_inode_info *ei = ISOFS_I(inode);
12771277
int ret = -EIO;
1278+
struct timespec64 ts;
12781279

12791280
block = ei->i_iget5_block;
12801281
bh = sb_bread(inode->i_sb, block);
@@ -1387,8 +1388,10 @@ static int isofs_read_inode(struct inode *inode, int relocated)
13871388
inode->i_ino, de->flags[-high_sierra]);
13881389
}
13891390
#endif
1390-
inode_set_mtime_to_ts(inode,
1391-
inode_set_atime_to_ts(inode, inode_set_ctime(inode, iso_date(de->date, high_sierra), 0)));
1391+
ts = iso_date(de->date, high_sierra ? ISO_DATE_HIGH_SIERRA : 0);
1392+
inode_set_ctime_to_ts(inode, ts);
1393+
inode_set_atime_to_ts(inode, ts);
1394+
inode_set_mtime_to_ts(inode, ts);
13921395

13931396
ei->i_first_extent = (isonum_733(de->extent) +
13941397
isonum_711(de->ext_attr_length));

fs/isofs/isofs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ static inline unsigned int isonum_733(u8 *p)
106106
/* Ignore bigendian datum due to broken mastering programs */
107107
return get_unaligned_le32(p);
108108
}
109-
extern int iso_date(u8 *, int);
109+
#define ISO_DATE_HIGH_SIERRA (1 << 0)
110+
#define ISO_DATE_LONG_FORM (1 << 1)
111+
struct timespec64 iso_date(u8 *p, int flags);
110112

111113
struct inode; /* To make gcc happy */
112114

fs/isofs/rock.c

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -412,35 +412,41 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
412412
}
413413
}
414414
break;
415-
case SIG('T', 'F'):
415+
case SIG('T', 'F'): {
416+
int flags, size, slen;
417+
418+
flags = rr->u.TF.flags & TF_LONG_FORM ? ISO_DATE_LONG_FORM : 0;
419+
size = rr->u.TF.flags & TF_LONG_FORM ? 17 : 7;
420+
slen = rr->len - 5;
416421
/*
417422
* Some RRIP writers incorrectly place ctime in the
418423
* TF_CREATE field. Try to handle this correctly for
419424
* either case.
420425
*/
421426
/* Rock ridge never appears on a High Sierra disk */
422427
cnt = 0;
423-
if (rr->u.TF.flags & TF_CREATE) {
424-
inode_set_ctime(inode,
425-
iso_date(rr->u.TF.times[cnt++].time, 0),
426-
0);
428+
if ((rr->u.TF.flags & TF_CREATE) && size <= slen) {
429+
inode_set_ctime_to_ts(inode,
430+
iso_date(rr->u.TF.data + size * cnt++, flags));
431+
slen -= size;
427432
}
428-
if (rr->u.TF.flags & TF_MODIFY) {
429-
inode_set_mtime(inode,
430-
iso_date(rr->u.TF.times[cnt++].time, 0),
431-
0);
433+
if ((rr->u.TF.flags & TF_MODIFY) && size <= slen) {
434+
inode_set_mtime_to_ts(inode,
435+
iso_date(rr->u.TF.data + size * cnt++, flags));
436+
slen -= size;
432437
}
433-
if (rr->u.TF.flags & TF_ACCESS) {
434-
inode_set_atime(inode,
435-
iso_date(rr->u.TF.times[cnt++].time, 0),
436-
0);
438+
if ((rr->u.TF.flags & TF_ACCESS) && size <= slen) {
439+
inode_set_atime_to_ts(inode,
440+
iso_date(rr->u.TF.data + size * cnt++, flags));
441+
slen -= size;
437442
}
438-
if (rr->u.TF.flags & TF_ATTRIBUTES) {
439-
inode_set_ctime(inode,
440-
iso_date(rr->u.TF.times[cnt++].time, 0),
441-
0);
443+
if ((rr->u.TF.flags & TF_ATTRIBUTES) && size <= slen) {
444+
inode_set_ctime_to_ts(inode,
445+
iso_date(rr->u.TF.data + size * cnt++, flags));
446+
slen -= size;
442447
}
443448
break;
449+
}
444450
case SIG('S', 'L'):
445451
{
446452
int slen;

fs/isofs/rock.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,9 @@ struct RR_PL_s {
6565
__u8 location[8];
6666
};
6767

68-
struct stamp {
69-
__u8 time[7]; /* actually 6 unsigned, 1 signed */
70-
} __attribute__ ((packed));
71-
7268
struct RR_TF_s {
7369
__u8 flags;
74-
struct stamp times[]; /* Variable number of these beasts */
70+
__u8 data[];
7571
} __attribute__ ((packed));
7672

7773
/* Linux-specific extension for transparent decompression */

fs/isofs/util.c

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,44 @@
1616
* to GMT. Thus we should always be correct.
1717
*/
1818

19-
int iso_date(u8 *p, int flag)
19+
struct timespec64 iso_date(u8 *p, int flags)
2020
{
2121
int year, month, day, hour, minute, second, tz;
22-
int crtime;
22+
struct timespec64 ts;
23+
24+
if (flags & ISO_DATE_LONG_FORM) {
25+
year = (p[0] - '0') * 1000 +
26+
(p[1] - '0') * 100 +
27+
(p[2] - '0') * 10 +
28+
(p[3] - '0') - 1900;
29+
month = ((p[4] - '0') * 10 + (p[5] - '0'));
30+
day = ((p[6] - '0') * 10 + (p[7] - '0'));
31+
hour = ((p[8] - '0') * 10 + (p[9] - '0'));
32+
minute = ((p[10] - '0') * 10 + (p[11] - '0'));
33+
second = ((p[12] - '0') * 10 + (p[13] - '0'));
34+
ts.tv_nsec = ((p[14] - '0') * 10 + (p[15] - '0')) * 10000000;
35+
tz = p[16];
36+
} else {
37+
year = p[0];
38+
month = p[1];
39+
day = p[2];
40+
hour = p[3];
41+
minute = p[4];
42+
second = p[5];
43+
ts.tv_nsec = 0;
44+
/* High sierra has no time zone */
45+
tz = flags & ISO_DATE_HIGH_SIERRA ? 0 : p[6];
46+
}
2347

24-
year = p[0];
25-
month = p[1];
26-
day = p[2];
27-
hour = p[3];
28-
minute = p[4];
29-
second = p[5];
30-
if (flag == 0) tz = p[6]; /* High sierra has no time zone */
31-
else tz = 0;
32-
3348
if (year < 0) {
34-
crtime = 0;
49+
ts.tv_sec = 0;
3550
} else {
36-
crtime = mktime64(year+1900, month, day, hour, minute, second);
51+
ts.tv_sec = mktime64(year+1900, month, day, hour, minute, second);
3752

3853
/* sign extend */
3954
if (tz & 0x80)
4055
tz |= (-1 << 8);
41-
56+
4257
/*
4358
* The timezone offset is unreliable on some disks,
4459
* so we make a sanity check. In no case is it ever
@@ -65,7 +80,7 @@ int iso_date(u8 *p, int flag)
6580
* for pointing out the sign error.
6681
*/
6782
if (-52 <= tz && tz <= 52)
68-
crtime -= tz * 15 * 60;
83+
ts.tv_sec -= tz * 15 * 60;
6984
}
70-
return crtime;
71-
}
85+
return ts;
86+
}

0 commit comments

Comments
 (0)