From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: chenchacha <chen.chenchacha@foxmail.com>
Cc: linux-kernel@vger.kernel.org,
Andy Shevchenko <andy.shevchenko@gmail.com>,
pali.rohar@gmail.com
Subject: Re: [PATCH 3/3] fs: fat: add ioctl method in fat filesystem driver
Date: Tue, 30 Jan 2018 20:23:03 +0900 [thread overview]
Message-ID: <87bmhbmvzc.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <0464dacb-b8f1-4bb2-3e05-e5f35ebf6e8e@foxmail.com>+BB9432B15A982F74 (chenchacha's message of "Tue, 30 Jan 2018 09:52:20 +0800")
chenchacha <chen.chenchacha@foxmail.com> writes:
> On 01/29/2018 09:02 PM, OGAWA Hirofumi wrote:
>> ChenGuanqiao <chen.chenchacha@foxmail.com> writes:
>>
>>> +static int fat_check_d_characters(char *label, unsigned long len)
>>> +{
>>> + int i;
>>> +
>>> + for (i = 0; i < len; ++i) {
>>> + switch (label[i]) {
>>> + case 'a' ... 'z':
>>> + label[i] = __toupper(label[i]);
>>> + case 'A' ... 'Z':
>>> + case '0' ... '9':
>>> + case '_':
>>> + case 0x20:
>>> + continue;
>>> + default:
>>> + return -EINVAL;
>>> + }
>> Same question with previous though, what windows do if label = "a b c"?
>> (this is including space other than end of name or extension.)
> In win7, the volume label will be capitalized, and leaving spaces.
> Or, you mean I need to fill the rest of the space with "0x20"?
I see. However, what win7 stored, BTW? It was "A B C ", or anything
other?
>>> +static int fat_ioctl_set_volume_label(struct file *file,
>>> + u8 __user *vol_label)
>>> +{
>>> + int err = 0;
>>> + u8 label[MSDOS_NAME];
>>> + struct timespec ts;
>>> + struct buffer_head *boot_bh;
>>> + struct buffer_head *vol_bh;
>>> + struct msdos_dir_entry *de;
>>> + struct fat_boot_sector *b;
>>> + struct inode *inode = file_inode(file);
>>> + struct super_block *sb = inode->i_sb;
>>> + struct msdos_sb_info *sbi = MSDOS_SB(sb);
>>> +
>> [...]
> I need remove "struct msdos_sb_info *sbi"?
If you didn't use sbi anymore, you should remove.
>>> + err = mnt_want_write_file(file);
>>> + if (err)
>>> + goto out;
>>> +
>>> + down_write(&sb->s_umount);
>> Looks like inode_lock() for rootdir is gone. It is necessary to
>> traverse+modify.
> Is it wrong for me to use the inode_lock() in patch v7? I need to lock
> inode here, and turn off immediately after
inode_lock() is necessary to protect race with other dir operations.
I asked at v7, locking order to prevent the AB locking order bug.
I.e.
mnt_want_write_file => down_write => inode_lock()
vs
down_write => mnt_want_write_file => inode_lock()
Which is right one?
> mark_buffer_dirty(vol_bh)?
What is this asking?
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2018-01-30 11:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 10:43 [PATCH v8 0/3] fs: fat: add ioctl to modify fat filesystem partion volume label ChenGuanqiao
2018-01-17 10:43 ` [PATCH 1/3] fs: fat: Add fat filesystem partition volume label in local structure ChenGuanqiao
2018-01-17 10:43 ` [PATCH 2/3] fs: fat: Add volume label entry method function ChenGuanqiao
2018-01-17 10:43 ` [PATCH 3/3] fs: fat: add ioctl method in fat filesystem driver ChenGuanqiao
2018-01-29 13:02 ` OGAWA Hirofumi
[not found] ` <0464dacb-b8f1-4bb2-3e05-e5f35ebf6e8e@foxmail.com>
2018-01-30 11:23 ` OGAWA Hirofumi [this message]
2018-01-30 11:32 ` Pali Rohár
2018-01-29 13:18 ` Andy Shevchenko
2018-01-29 16:43 ` Pali Rohár
[not found] ` <5a7011dd.ca40650a.885bf.f16eSMTPIN_ADDED_BROKEN@mx.google.com>
2018-01-30 8:48 ` Pali Rohár
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=87bmhbmvzc.fsf@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=andy.shevchenko@gmail.com \
--cc=chen.chenchacha@foxmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@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
Powered by JetHome