Skip to contentSkip to conversation

Problems unlinking files

DISCUSSION Chris AtLee 2 participants 4 messages Jun 19, 2002 – Sep 11, 2002 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I've noticed some problems with unlinking files with JFFS2 in my linux 2.2.18 port. After unlinking a file, it doesn't appear in the directory listing, but if I do an 'ls' on the unlinked file, I can still get information on the file. I can still read and write to the file, but it refuses to show up in the directory listing. After I unmount the JFFS2 partition and remount it the file isn't there at all.

Any ideas? I'm sure I must have deleted something important getting everything working with linux 2.2.18.

Thanks,
Chris

#1 lore raw
Quoted 7 lines · [email protected] said:

I've noticed some problems with unlinking files with JFFS2 in my linux 2.2.18 port. After unlinking a file, it doesn't appear in the directory listing, but if I do an 'ls' on the unlinked file, I can still get information on the file. I can still read and write to the file, but it refuses to show up in the directory listing. After I unmount the JFFS2 partition and remount it the file isn't there at all.

Can you run with CONFIG_JFFS2_FS_DEBUG=1 and show the output while you unlink the file, then open it again?

Preferably using a serial console, and they'll be KERN_DEBUG messages so you'll need to echo 9 > /proc/sys/kernel/printk to make them get printed.

Quoted 2 lines

Any ideas? I'm sure I must have deleted something important getting everything working with linux 2.2.18.

Show me your jffs2_unlink() and jffs2_do_unlink() -- and indeed the rest of it :)

--
dwmw2

#2 lore raw

Sorry for the delay, I was on vacation last week. Attached is a log of what I get with CONFIG_JFFS2_FS_DEBUG=1 and /proc/sys/kernel/printk = 9

In addition, I notice that if I keep unlinking the file, the link count goes from 0 to 65535 then 65534, 65533, ...

I've put up a tarball with my 2.2.18 changes at:
http://atlee.ca/jffs2-2.2.18.tar.gz

Cheers,
Chris

Quoted 16 lines · David Woodhouse
Quoted 7 lines · [email protected] said:

I've noticed some problems with unlinking files with JFFS2 in my linux 2.2.18 port. After unlinking a file, it doesn't appear in the directory listing, but if I do an 'ls' on the unlinked file, I can still get information on the file. I can still read and write to the file, but it refuses to show up in the directory listing. After I unmount the JFFS2 partition and remount it the file isn't there at all.

Can you run with CONFIG_JFFS2_FS_DEBUG=1 and show the output while you unlink the file, then open it again?

Preferably using a serial console, and they'll be KERN_DEBUG messages so you'll need to echo 9 > /proc/sys/kernel/printk to make them get printed.

Quoted 11 lines
Quoted 2 lines

Any ideas? I'm sure I must have deleted something important getting everything working with linux 2.2.18.

Show me your jffs2_unlink() and jffs2_do_unlink() -- and indeed the rest of it :)

--
dwmw2

# touch test2
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_lookup()
jffs2_create()
jffs2_new_inode(): dir_i 1, mode 0x81a4
Allocated inocache at c05181d0
jffs2_do_new_inode(): Assigned ino# 29
jffs2_reserve_space(): Requested 0x44 bytes
jffs2_reserve_space(): alloc sem got
jffs2_do_reserve_space(): Giving 0xf3a0 bytes at 0x1d0c60
jffs2_do_create(): reserved 0xf3a0 bytes
jffs2_add_physical_node_ref(): Node at 0x1d0c60, size 0x44
jffs2_write_dnode wrote node at 0x001d0c60 with dsize 0x0, csize 0x0, node_crc 0xe0303e57, data_crc 0x00000000, totlen 0x00000044
jffs2_do_create created file with mode 0x81a4
jffs2_write_dirent(ino #1, name at *0xc04fa304 "test2"->ino #29, name_crc 0xd5997a45)
jffs2_add_physical_node_ref(): Node at 0x1d0ca4, size 0x30
jffs2_add_fd_to_list( c01f4e60, c0535b4c (->c01f4f20))
jffs2_complete_reservation()
thread_should_wake(): nr_free_blocks 41, nr_erasing_blocks 0, dirty_size 0x1fcfc (mod 0x1fcfc
): no
jffs2_create: Created ino #29 with mode 100644, nlink 1(1)
# ls -l test2
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
-rw-r--r--    1 root     root            0 Jan  1 00:04 test2
# rm test2
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_reserve_space(): Requested 0x30 bytes
jffs2_reserve_space(): alloc sem got
jffs2_do_reserve_space(): Giving 0xf32c bytes at 0x1d0cd4
jffs2_write_dirent(ino #1, name at *0xc04fa304 "test2"->ino #0, name_crc 0xd5997a45)
jffs2_add_physical_node_ref(): Node at 0x1d0cd4, size 0x30
jffs2_add_fd_to_list( c01f4920, c0535b4c (->c01f4f20))
Marking old dirent node (ino #29) obsolete
obliterating obsoleted node at 0x001d0ca4
jffs2_complete_reservation()
thread_should_wake(): nr_free_blocks 41, nr_erasing_blocks 0, dirty_size 0x1fd2c (mod 0x1fd2c
): no
# ls -l test2
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
jffs2_readdir() for dir_i #1
Dirent 0: ".", ino #1
Dirent 1: "..", ino #1
jffs2_readdir() for dir_i #1
-rw-r--r--    0 root     root            0 Jan  1 00:04 test2
# 
#3 lore raw
In reply to Chris AtLee
Quoted 7 lines · On Wed, 19 June 2002, [email protected] said:

I've noticed some problems with unlinking files with JFFS2 in my linux 2.2.18 port. After unlinking a file, it doesn't appear in the directory listing, but if I do an 'ls' on the unlinked file, I can still get information on the file. I can still read and write to the file, but it refuses to show up in the directory listing. After I unmount the JFFS2 partition and remount it the file isn't there at all.

This is now fixed, isn't it? Is the 2.2 port now working completely?

--
dwmw2