fat: support O_TMPFILE
Subsystems (3)
Christian Brauner
maintainercover fat: support O_TMPFILE
This adds O_TMPFILE support to vfat and msdos.
Currently, every O_TMPFILE open on FAT fails with EOPNOTSUPP and userspace falls back to creating a named temporary file and renaming it into place. systemd does that in bootctl when it writes to the ESP.
FAT can do O_TMPFILE just fine. It already handles files without a directory entry: when an open file is unlinked i_pos is reset to 0, writing the inode does nothing and the clusters are freed when the inode is evicted. An O_TMPFILE simply starts out in that state.
The only tricky part is linkat(). FAT has no hard links so I added a ->link() that only gives an O_TMPFILE its first name. Everything else still fails with EPERM. Adding just ->tmpfile() would've been a regression. systemd only falls back to the named temporary file if the O_TMPFILE open fails. If the open succeeds it calls linkat() and gives up if that fails.
---
Christian Brauner (4):
fat: add fat_tmpfile()
fat: support O_TMPFILE on vfat
fat: support O_TMPFILE on msdos selftests/filesystems: add FAT O_TMPFILE tests
fs/fat/fat.h | 2 + fs/fat/inode.c | 31 ++ fs/fat/namei_msdos.c | 70 +++++ fs/fat/namei_vfat.c | 46 +++ tools/testing/selftests/filesystems/fat/.gitignore | 1 + tools/testing/selftests/filesystems/fat/Makefile | 2 +- tools/testing/selftests/filesystems/fat/config | 1 + .../selftests/filesystems/fat/run_fat_tests.sh | 41 +++ tools/testing/selftests/filesystems/fat/tmpfile.c | 324 +++++++++++++++++++++ 9 files changed, 517 insertions(+), 1 deletion(-)
---
base-commit: 2dc60bd9975fc8666a13d58410499e06e6799ba9
change-id: 20261126-work-fat-tmpfile-0d0f49e95d8f
Christian Brauner
maintainerPATCH 1/4 fat: add fat_tmpfile()
FAT already knows how to deal with a file that is open but has no directory entry. When an open file is unlinked fat_detach() resets i_pos to 0. From then on __fat_write_inode() has nothing to write, the data still goes to the file's cluster chain, and fat_evict_inode() frees the chain when the last reference is put.
An O_TMPFILE is a file that starts out in that state. So build the inode like fat_build_inode() does, from a directory entry that only exists in memory, but don't attach it. fat_build_inode() itself can't be used for this. It would attach the inode at i_pos 0 and the next O_TMPFILE would find it through fat_iget().
The mode is ignored, just like in vfat_create() and msdos_create(). On FAT it's derived from the mount options.
Nothing uses fat_tmpfile() yet. vfat and msdos need a ->link() method first and wire it up in the following patches.
--- fs/fat/fat.h | 2 ++ fs/fat/inode.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
fs/fat/fat.h +2 -0
@@ -423,6 +423,8 @@ extern void fat_detach(struct inode *inode);extern struct inode *fat_iget (struct super_block *sb,loff_t i_pos);extern struct inode *fat_build_inode (struct super_block *sb,struct msdos_dir_entry *de,loff_t i_pos); +int fat_tmpfile (const struct mnt_idmap *idmap,struct inode *dir, +struct file *file,umode_t mode);extern int fat_fill_super (struct super_block *sb,struct fs_context *fc,void (*setup)(struct super_block *));extern int fat_fill_inode (struct inode *inode,struct msdos_dir_entry *de);
fs/fat/inode.c +31 -0
@@ -626,6 +626,37 @@ struct inode *fat_build_inode(struct super_block *sb,EXPORT_SYMBOL_GPL (fat_build_inode); +/* Like an open file that got unlinked: no directory entry, i_pos is 0. */ +int fat_tmpfile (const struct mnt_idmap *idmap,struct inode *dir, +struct file *file,umode_t mode) +{ +struct super_block *sb = dir->i_sb; +struct msdos_dir_entry de = { .attr =ATTR_ARCH }; +struct timespec64 ts =current_time (dir); +struct inode *inode; +int err; + +fat_time_unix2fat (MSDOS_SB (sb), &ts, &de.time, &de.date, &de.ctime_cs); + de.ctime = de.time; + de.cdate = de.date; + de.adate = de.date; + + inode =new_inode (sb); +if (!inode) +return -ENOMEM ; + inode->i_ino =iunique (sb,MSDOS_ROOT_INO ); +inode_set_iversion (inode,1 ); + err =fat_fill_inode (inode, &de); +if (err) { +iput (inode); +return err; + } +insert_inode_hash (inode); +d_tmpfile (file, inode); +return finish_open_simple (file,0 ); +} +EXPORT_SYMBOL_GPL (fat_tmpfile); +static int __fat_write_inode (struct inode *inode); static int fat_sync_inode_metadata(struct inode *inode,
Signature · 1 line
2.53.0
Christian Brauner
maintainerPATCH 2/4 fat: support O_TMPFILE on vfat
In reply to Christian BraunerCurrently, vfat doesn't implement ->link() since FAT has no hard links and link(2) fails with EPERM. But O_TMPFILE is only half a feature without linkat(). Worse, implementing just ->tmpfile() would break userspace that works fine right now. systemd's open_tmpfile_linkable_at() only falls back to a named temporary file if opening with O_TMPFILE fails. If the open succeeds link_tmpfile_at() calls linkat() and gives up if that fails. bootctl writes loader.conf, entries.srel and the boot loader binaries to the ESP like that.
So add a ->link() that only gives an O_TMPFILE its first name. vfs_link() refuses to link an inode without links unless it is I_LINKABLE and it checks that under the inode lock. So an inode without links that makes it into vfat_link() is an O_TMPFILE that may be linked. Everything else still gets EPERM.
Linking does what vfat_rename() does for a new name: add the directory entry, attach the inode at its position and let the inode write fill in the start cluster and the size.
If the system crashes while an O_TMPFILE is open its clusters stay allocated but no directory entry refers to them. The same thing happens to an open file that was unlinked. fsck.fat finds them as lost clusters, with -a it saves them to FSCKnnnn.REC files. ext2, minix and udf implement O_TMPFILE without orphan handling as well.
--- fs/fat/namei_vfat.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
fs/fat/namei_vfat.c +46 -0
@@ -938,6 +938,50 @@ static void vfat_update_dir_metadata(struct inode *dir, struct timespec64 *ts) (void )sync_inode_metadata (dir,1 ); } +static int vfat_link (struct dentry *old_dentry,struct inode *dir, +struct dentry *dentry) +{ +struct inode *inode =d_inode (old_dentry); +struct super_block *sb = dir->i_sb; +struct fat_slot_info sinfo; +struct timespec64 ts; +int err, err2; + +/* No hard links on FAT, only give an O_TMPFILE its first name. */ +if (inode->i_nlink) +return -EPERM ; + +mutex_lock (&MSDOS_SB (sb)->s_lock); + + ts =current_time (dir); + err =vfat_add_entry (dir, &dentry->d_name,0 ,0 , &ts, &sinfo); +if (err) + goto out; +inode_inc_iversion (dir); + +fat_attach (inode, sinfo.i_pos); + err =vfat_sync_ipos (dir, inode); +if (err) + goto out_detach; +brelse (sinfo.bh); + +inc_nlink (inode); +ihold (inode); +d_instantiate (dentry, inode); +mutex_unlock (&MSDOS_SB (sb)->s_lock); +return 0 ; + +out_detach: +fat_detach (inode); + err2 =fat_remove_entries (dir, &sinfo);/* and releases bh */ +if (err2) +fat_msg (sb,KERN_WARNING , +"failed to roll back new entry (%d)" , err2); +out: +mutex_unlock (&MSDOS_SB (sb)->s_lock); +return err; +} +static int vfat_rename (struct inode *old_dir,struct dentry *old_dentry,struct inode *new_dir,struct dentry *new_dentry) {
@@ -1190,10 +1234,12 @@ static int vfat_rename2(const struct mnt_idmap *idmap, struct inode *old_dir,static const struct inode_operations vfat_dir_inode_operations = { .create = vfat_create, .lookup = vfat_lookup, + .link = vfat_link, .unlink = vfat_unlink, .mkdir = vfat_mkdir, .rmdir = vfat_rmdir, .rename = vfat_rename2, + .tmpfile = fat_tmpfile, .setattr = fat_setattr, .getattr = fat_getattr, .fileattr_get = fat_fileattr_get,
Signature · 1 line
2.53.0
Christian Brauner
maintainerPATCH 3/4 fat: support O_TMPFILE on msdos
In reply to Christian BraunerDo what vfat does. msdos_link() creates the directory entry the same way msdos_create() does and handles ATTR_HIDDEN like do_msdos_rename(). With the dots mount option a leading dot means the file is hidden and __fat_write_inode() writes the attributes from i_attrs. So i_attrs has to agree with the new name.
--- fs/fat/namei_msdos.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
fs/fat/namei_msdos.c +70 -0
@@ -439,6 +439,74 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)return err; } +/***** Give an O_TMPFILE its first name */ +static int msdos_link (struct dentry *old_dentry,struct inode *dir, +struct dentry *dentry) +{ +struct inode *inode =d_inode (old_dentry); +struct super_block *sb = dir->i_sb; +struct fat_slot_info sinfo; +unsigned char msdos_name[MSDOS_NAME ]; +struct timespec64 ts; +int err, err2, is_hid, old_attrs; + +/* FAT has no hard links. */ +if (inode->i_nlink) +return -EPERM ; + +mutex_lock (&MSDOS_SB (sb)->s_lock); + + err =msdos_format_name (dentry->d_name.name, dentry->d_name.len, + msdos_name, &MSDOS_SB (sb)->options); +if (err) + goto out; + is_hid = (dentry->d_name.name[0 ] =='.' ) && (msdos_name[0 ] !='.' ); +/* Have to do it due to foo vs. .foo conflicts */ +if (!fat_scan (dir, msdos_name, &sinfo)) { +brelse (sinfo.bh); + err = -EINVAL ; + goto out; + } + + ts =current_time (dir); + err =msdos_add_entry (dir, msdos_name,0 , is_hid,0 , &ts, &sinfo); +if (err) + goto out; +inode_inc_iversion (dir); + + old_attrs =MSDOS_I (inode)->i_attrs; +fat_attach (inode, sinfo.i_pos); +if (is_hid) +MSDOS_I (inode)->i_attrs |=ATTR_HIDDEN ; +else +MSDOS_I (inode)->i_attrs &= ~ATTR_HIDDEN ; +mark_inode_dirty (inode); +if (IS_DIRSYNC (dir)) { + err =sync_inode_metadata (inode,1 ); +if (err) + goto out_detach; + } +brelse (sinfo.bh); + +inc_nlink (inode); +ihold (inode); +d_instantiate (dentry, inode); +mutex_unlock (&MSDOS_SB (sb)->s_lock); +fat_flush_inodes (sb, dir, inode); +return 0 ; + +out_detach: +fat_detach (inode); +MSDOS_I (inode)->i_attrs = old_attrs; + err2 =fat_remove_entries (dir, &sinfo);/* and releases bh */ +if (err2) +fat_msg (sb,KERN_WARNING , +"failed to roll back new entry (%d)" , err2); +out: +mutex_unlock (&MSDOS_SB (sb)->s_lock); +return err; +} + static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, struct dentry *old_dentry, struct inode *new_dir, unsigned char *new_name,
@@ -651,10 +719,12 @@ static int msdos_rename(const struct mnt_idmap *idmap,static const struct inode_operations msdos_dir_inode_operations = { .create = msdos_create, .lookup = msdos_lookup, + .link = msdos_link, .unlink = msdos_unlink, .mkdir = msdos_mkdir, .rmdir = msdos_rmdir, .rename = msdos_rename, + .tmpfile = fat_tmpfile, .setattr = fat_setattr, .getattr = fat_getattr, .fileattr_get = fat_fileattr_get,
Signature · 1 line
2.53.0
Christian Brauner
maintainerPATCH 4/4 selftests/filesystems: add FAT O_TMPFILE tests
In reply to Christian BraunerAdd tests for O_TMPFILE on vfat and msdos. run_fat_tests.sh runs them on a vfat mount and on an msdos mount with the dots option. This tests that:
- an O_TMPFILE can be linked into its own and into another directory
- data written before and after linkat() ends up in the named file
- O_EXCL keeps it from being linked
- it can't be linked twice, nor again after it was unlinked
- a failed linkat() leaves it linkable
- link(2) of a regular file still fails with EPERM
- linkat() to a temporary name plus rename() replaces a file
- closing an unnamed O_TMPFILE frees its clusters
- with dots a leading dot makes the linked file hidden
After the tests the image is unmounted, checked with fsck.vfat -n and mounted again to compare a linked O_TMPFILE with a regular copy.
--- tools/testing/selftests/filesystems/fat/.gitignore | 1 + tools/testing/selftests/filesystems/fat/Makefile | 2 +- tools/testing/selftests/filesystems/fat/config | 1 + .../selftests/filesystems/fat/run_fat_tests.sh | 41 +++ tools/testing/selftests/filesystems/fat/tmpfile.c | 324 +++++++++++++++++++++ 5 files changed, 368 insertions(+), 1 deletion(-)
tools/testing/selftests/filesystems/fat/.gitignore +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only rename_exchange +tmpfile
tools/testing/selftests/filesystems/fat/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 TEST_PROGS := run_fat_tests.sh -TEST_GEN_PROGS_EXTENDED := rename_exchange +TEST_GEN_PROGS_EXTENDED := rename_exchange tmpfile CFLAGS += -O2 -g -Wall $(KHDR_INCLUDES) include ../../lib.mk
tools/testing/selftests/filesystems/fat/config +1 -0
@@ -1,2 +1,3 @@ CONFIG_BLK_DEV_LOOP=y +CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y
tools/testing/selftests/filesystems/fat/run_fat_tests.sh +41 -0
58 lines not on this page · raw message
tools/testing/selftests/filesystems/fat/tmpfile.c new file +324 -0
324 lines not on this page · raw message
Signature · 1 line
2.53.0
Quoted 12 lines · Christian Brauner
This adds
O_TMPFILEsupport to vfat and msdos.Currently, every
O_TMPFILEopen on FAT fails with EOPNOTSUPP and userspace falls back to creating a named temporary file and renaming it
into place. systemd does that in bootctl when it writes to the ESP.FAT can do
O_TMPFILEjust fine. It already handles files without a directory entry: when an open file is unlinkedi_posis reset to 0, writing the inode does nothing and the clusters are freed when the inode is evicted. AnO_TMPFILEsimply starts out in that state.
Quoted 8 lines
The only tricky part is
linkat(). FAT has no hard links so I added a ->link() that only gives anO_TMPFILEits first name. Everything else still fails with EPERM. Adding just ->tmpfile() would've been a regression. systemd only falls back to the named temporary file if theO_TMPFILEopen fails. If the open succeeds it callslinkat()and gives
up if that fails.
Hi Christian,
Quoted 2 lines
Signed-off-by Christian Brauner (Amutable) <[email protected]>
For the entire series:
Kind regards,
Alex
Quoted 21 lines
---
Christian Brauner (4):
fat: addfat_tmpfile()
fat: supportO_TMPFILEon vfat
fat: supportO_TMPFILEon msdos selftests/filesystems: add FATO_TMPFILEtestsfs/fat/fat.h | 2 + fs/fat/inode.c | 31 ++ fs/fat/namei_msdos.c | 70 +++++ fs/fat/namei_vfat.c | 46 +++
tools/testing/selftests/filesystems/fat/.gitignore| 1 + tools/testing/selftests/filesystems/fat/Makefile | 2 +- tools/testing/selftests/filesystems/fat/config | 1 + .../selftests/filesystems/fat/run_fat_tests.sh | 41 +++ tools/testing/selftests/filesystems/fat/tmpfile.c | 324
+++++++++++++++++++++9 files changed, 517 insertions(+), 1 deletion(-)---
base-commit:2dc60bd9975fc8666a13d58410499e06e6799ba9
change-id: 20261126-work-fat-tmpfile-0d0f49e95d8f
OGAWA Hirofumi
maintainerRe: [PATCH 2/4] fat: support O_TMPFILE on vfat
In reply to Christian BraunerQuoted 51 lines · Christian Brauner
Currently, vfat doesn't implement ->link() since FAT has no hard links and link(2) fails with EPERM. But
O_TMPFILEis only half a feature withoutlinkat(). Worse, implementing just ->tmpfile() would break userspace that works fine right now. systemd'sopen_tmpfile_linkable_at()only falls back to a named temporary file if opening withO_TMPFILEfails. If the open succeedslink_tmpfile_at()callslinkat()and gives up if that fails. bootctl writes loader.conf, entries.srel and the boot loader binaries to the ESP like that.So add a ->link() that only gives an
O_TMPFILEits first name.vfs_link()refuses to link an inode without links unless it isI_LINKABLEand it checks that under the inode lock. So an inode without links that makes it intovfat_link()is anO_TMPFILEthat may be linked. Everything else still gets EPERM.Linking does what
vfat_rename()does for a new name: add the directory entry, attach the inode at its position and let the inode write fill in the start cluster and the size.If the system crashes while an
O_TMPFILEis open its clusters stay allocated but no directory entry refers to them. The same thing happens to an open file that was unlinked. fsck.fat finds them as lost clusters, with -a it saves them to FSCKnnnn.REC files. ext2, minix and udf implementO_TMPFILEwithout orphan handling as well.Signed-off-by Christian Brauner (Amutable) <[email protected]>--- fs/fat/namei_vfat.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)fs/fat/namei_vfat.c +13
-0@@ -938,6 +938,50 @@ static void vfat_update_dir_metadata(struct inode *dir, struct timespec64 *ts) (void )sync_inode_metadata (dir,1 ); } +static int vfat_link (struct dentry *old_dentry,struct inode *dir, +struct dentry *dentry) +{ +struct inode *inode =d_inode (old_dentry); +struct super_block *sb = dir->i_sb; +struct fat_slot_info sinfo; +struct timespec64 ts; +int err, err2; + +/* No hard links on FAT, only give an O_TMPFILE its first name. */ +if (inode->i_nlink) +return -EPERM ; +
fs/fat/namei_vfat.c static void vfat_update_dir_metadata(struct inode *dir, struct timespec64 *ts) · line 963
Quoted 10 lines
fs/fat/namei_vfat.c +10
-0+mutex_lock (&MSDOS_SB (sb)->s_lock); + + ts =current_time (dir); + err =vfat_add_entry (dir, &dentry->d_name,0 ,0 , &ts, &sinfo); +if (err) + goto out; +inode_inc_iversion (dir); + +fat_attach (inode, sinfo.i_pos); + err =vfat_sync_ipos (dir, inode);
Please add "FIXME: this sync should be done within vfat_add_entry()"
Thanks.
Quoted 3 lines
fs/fat/namei_vfat.c +3
-0+if (err) + goto out_detach; +brelse (sinfo.bh);
[...]
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerRe: [PATCH 3/4] fat: support O_TMPFILE on msdos
In reply to Christian BraunerQuoted 23 lines · Christian Brauner
Do what vfat does.
msdos_link()creates the directory entry the same waymsdos_create()does and handlesATTR_HIDDENlikedo_msdos_rename(). With the dots mount option a leading dot means the file is hidden and__fat_write_inode()writes the attributes fromi_attrs. Soi_attrshas to agree with the new name.Signed-off-by Christian Brauner (Amutable) <[email protected]>--- fs/fat/namei_msdos.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)fs/fat/namei_msdos.c +4
-0@@ -439,6 +439,74 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)return err; } +/***** Give an O_TMPFILE its first name */ +static int msdos_link (struct dentry *old_dentry,struct inode *dir, +struct dentry *dentry) +{
[...]
fs/fat/namei_msdos.c static int msdos_unlink(struct inode *dir, struct dentry *dentry) · line 469
Quoted 11 lines
fs/fat/namei_msdos.c +11
-0+ err =msdos_format_name (dentry->d_name.name, dentry->d_name.len, + msdos_name, &MSDOS_SB (sb)->options); +if (err) + goto out; + is_hid = (dentry->d_name.name[0 ] =='.' ) && (msdos_name[0 ] !='.' ); +/* Have to do it due to foo vs. .foo conflicts */ +if (!fat_scan (dir, msdos_name, &sinfo)) { +brelse (sinfo.bh); + err = -EINVAL ; + goto out; + }
Maybe this part is better to share with others?
Quoted 5 lines
fs/fat/namei_msdos.c +5
-0+ ts =current_time (dir); + err =msdos_add_entry (dir, msdos_name,0 , is_hid,0 , &ts, &sinfo); +if (err) + goto out; +inode_inc_iversion (dir);
fs/fat/namei_msdos.c static int msdos_unlink(struct inode *dir, struct dentry *dentry) · line 485
Quoted 10 lines
fs/fat/namei_msdos.c +10
-0+ + old_attrs =MSDOS_I (inode)->i_attrs; +fat_attach (inode, sinfo.i_pos); +if (is_hid) +MSDOS_I (inode)->i_attrs |=ATTR_HIDDEN ; +else +MSDOS_I (inode)->i_attrs &= ~ATTR_HIDDEN ; +mark_inode_dirty (inode); +if (IS_DIRSYNC (dir)) { + err =sync_inode_metadata (inode,1 );
Please add "FIXME: this sync should be done within msdos_add_entry()"
Thanks.
Quoted 4 lines
fs/fat/namei_msdos.c +4
-0+if (err) + goto out_detach; + } +brelse (sinfo.bh);
[...]
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerRe: [PATCH 1/4] fat: add fat_tmpfile()
In reply to Christian BraunerQuoted 49 lines · Christian Brauner
FAT already knows how to deal with a file that is open but has no directory entry. When an open file is unlinked
fat_detach()resetsi_posto 0. From then on__fat_write_inode()has nothing to write, the data still goes to the file's cluster chain, andfat_evict_inode()frees the chain when the last reference is put.An
O_TMPFILEis a file that starts out in that state. So build the inode likefat_build_inode()does, from a directory entry that only exists in memory, but don't attach it.fat_build_inode()itself can't be used for this. It would attach the inode ati_pos0 and the nextO_TMPFILEwould find it throughfat_iget().The mode is ignored, just like in
vfat_create()andmsdos_create(). On FAT it's derived from the mount options.Nothing uses
fat_tmpfile()yet. vfat and msdos need a ->link() method first and wire it up in the following patches.Signed-off-by Christian Brauner (Amutable) <[email protected]>--- fs/fat/fat.h | 2 ++ fs/fat/inode.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)fs/fat/fat.h +2
-0@@ -423,6 +423,8 @@ extern void fat_detach(struct inode *inode);extern struct inode *fat_iget (struct super_block *sb,loff_t i_pos);extern struct inode *fat_build_inode (struct super_block *sb,struct msdos_dir_entry *de,loff_t i_pos); +int fat_tmpfile (const struct mnt_idmap *idmap,struct inode *dir, +struct file *file,umode_t mode);extern int fat_fill_super (struct super_block *sb,struct fs_context *fc,void (*setup)(struct super_block *));extern int fat_fill_inode (struct inode *inode,struct msdos_dir_entry *de);fs/fat/inode.c +4
-0@@ -626,6 +626,37 @@ struct inode *fat_build_inode(struct super_block *sb,EXPORT_SYMBOL_GPL (fat_build_inode); +/* Like an open file that got unlinked: no directory entry, i_pos is 0. */ +int fat_tmpfile (const struct mnt_idmap *idmap,struct inode *dir, +struct file *file,umode_t mode) +{
[...]
fs/fat/inode.c struct inode *fat_build_inode(struct super_block *sb, · line 654
Quoted 11 lines
fs/fat/inode.c +11
-0+ inode =new_inode (sb); +if (!inode) +return -ENOMEM ; + inode->i_ino =iunique (sb,MSDOS_ROOT_INO ); +inode_set_iversion (inode,1 ); + err =fat_fill_inode (inode, &de); +if (err) { +iput (inode); +return err; + } +insert_inode_hash (inode);
This part is almost copy of fat_build_inode(). Maybe it is better to add as a new helper function to share with fat_build_inode().
Thanks.
Quoted 4 lines
fs/fat/inode.c +4
-0+d_tmpfile (file, inode); +return finish_open_simple (file,0 ); +} +EXPORT_SYMBOL_GPL (fat_tmpfile);
Signature · 1 line
OGAWA Hirofumi <[email protected]>