From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Chung-Chiang Cheng <cccheng@synology.com>
Cc: linux-kernel@vger.kernel.org, kernel@cccheng.net, shepjeng@gmail.com
Subject: Re: [PATCH v3 2/3] fat: make ctime and mtime identical explicitly
Date: Fri, 15 Apr 2022 22:28:08 +0900 [thread overview]
Message-ID: <87czhitr13.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20220415094518.380543-2-cccheng@synology.com> (Chung-Chiang Cheng's message of "Fri, 15 Apr 2022 17:45:17 +0800")
Chung-Chiang Cheng <cccheng@synology.com> writes:
> - fat_truncate_time(dir, NULL, S_ATIME|S_MTIME);
> + fat_truncate_time(dir, NULL, S_ATIME|S_CTIME|S_MTIME);
fat_truncate_time() updates i_ctime too. So S_CTIME should not be
necessary here. And I think this is better to use only S_MTIME to tell
this is the point of mtime update.
(And, in fat_truncate_time(), I think S_CTIME is not required, because
we ignore ctime change, isn't it?)
Or you are going to update mtime on rename, etc too?
> + /*
> + * ctime and mtime share the same on-disk field, and should be
> + * identical in memory.
> + */
> + if (flags & (S_CTIME|S_MTIME)) {
> fat_truncate_mtime(sbi, now, &inode->i_mtime);
> + inode->i_ctime = inode->i_mtime;
> + }
[...]
> clear_nlink(inode);
> - fat_truncate_time(inode, NULL, S_CTIME);
> + fat_truncate_time(inode, NULL, S_CTIME|S_MTIME);
This is the point to update ctime. You want to affect ctime change to
mtime? As I said in previous post, I think we are better to ignore ctime
change, because it may become yet another incompatible behavior.
> fat_detach(inode);
> out:
> mutex_unlock(&MSDOS_SB(sb)->s_lock);
> @@ -415,7 +415,7 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
> if (err)
> goto out;
> clear_nlink(inode);
> - fat_truncate_time(inode, NULL, S_CTIME);
> + fat_truncate_time(inode, NULL, S_CTIME|S_MTIME);
ditto
> fat_detach(inode);
> out:
> mutex_unlock(&MSDOS_SB(sb)->s_lock);
> @@ -550,7 +550,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
> drop_nlink(new_inode);
> if (is_dir)
> drop_nlink(new_inode);
> - fat_truncate_time(new_inode, &ts, S_CTIME);
> + fat_truncate_time(new_inode, &ts, S_CTIME|S_MTIME);
ditto
> }
> out:
[...]
> @@ -981,7 +981,7 @@ static int vfat_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
> drop_nlink(new_inode);
> if (is_dir)
> drop_nlink(new_inode);
> - fat_truncate_time(new_inode, &ts, S_CTIME);
> + fat_truncate_time(new_inode, &ts, S_CTIME|S_MTIME);
ditto
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2022-04-15 13:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 9:45 [PATCH v3 1/3] fat: split fat_truncate_time() into separate functions Chung-Chiang Cheng
2022-04-15 9:45 ` [PATCH v3 2/3] fat: make ctime and mtime identical explicitly Chung-Chiang Cheng
2022-04-15 13:28 ` OGAWA Hirofumi [this message]
2022-04-22 8:24 ` Chung-Chiang Cheng
2022-04-15 9:45 ` [PATCH v3 3/3] fat: report creation time in statx Chung-Chiang Cheng
2022-04-15 13:17 ` OGAWA Hirofumi
2022-04-22 8:20 ` Chung-Chiang Cheng
2022-04-22 12:06 ` OGAWA Hirofumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czhitr13.fsf@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=cccheng@synology.com \
--cc=kernel@cccheng.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shepjeng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox