Skip to contentSkip to conversation

vfs pile 1

GIT PULL Al Viro 5 participants 16 messages Jan 5, 2012 – Jan 12, 2012

Subsystems (2)
lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

That's pile 1 out of at least 4; this one is mostly vfsmount gutting. The next one will be umode_t stuff... Please, pull from the usual place -
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus

Shortlog:
Al Viro (73):
pull manipulations of rpc_cred inside alloc_nfs_open_context() trim fs/internal.h
switch a bunch of places to mnt_want_write_file()
new helpers: fh_{want,drop}_write()
vfs: kill pointless helpers in namespace.c
vfs: new internal helper: mnt_has_parent(mnt)
vfs: more mnt_parent cleanups
vfs: add missing parens in pnode.h macros
unexport put_mnt_ns(), make create_mnt_ns() static outright
vfs: dentry_reset_mounted() doesn't use vfsmount argument
tomoyo: stop including hell knows what
btrfs, nfs, apparmor: don't pull mnt_namespace.h for no reason...
vfs: kill ->mnt_devname use in afs printks
make nfs_follow_remote_path() handle ERR_PTR() passed as root_mnt
vfs: convert fs_supers to hlist
vfs: make do_kern_mount() static
constify seq_file stuff
vfs: mnt_drop_write_file()
vfs: fix the stupidity with i_dentry in inode destructors
vfs: pipe.c is really non-modular
get rid of timer in kern/acct.c
vfs: for usbfs, etc. internal vfsmounts ->mnt_sb->s_root == ->mnt_root
vfs: live vfsmounts never have NULL ->mnt_sb
vfs: new helper - vfs_ustat()
vfs: fix the rest of sget() races
vfs: start hiding vfsmount guts series
vfs: spread struct mount - __lookup_mnt() result
vfs: spread struct mount - __propagate_umount() argument
vfs: spread struct mount - namespace.c internal iterators
vfs: spread struct mount - attach_mnt/detach_mnt
vfs: spread struct mount - commit_tree
vfs: spread struct mount - mount group id handling
vfs: spread struct mount - attach_recursive_mnt
vfs: spread struct mount - tree_contains_unbindable
vfs: spread struct mount - alloc_vfsmnt/free_vfsmnt/mnt_alloc_id/mnt_free_id
vfs: spread struct mount - change_mnt_propagation/set_mnt_shared
vfs: spread struct mount - clone_mnt/copy_tree result
vfs: spread struct mount to remaining users of ->mnt_hash
vfs: the first spoils - mnt_hash moved
vfs: spread struct mount - umount_tree argument
vfs: spread struct mount - shrink_submounts/select_submounts
vfs: spread struct mount - clone_mnt/copy_tree argument
vfs: spread struct mount mnt_set_mountpoint child argument
vfs: spread struct mount - do_umount/propagate_mount_busy
vfs: spread struct mount - mnt_has_parent
vfs: spread struct mount - is_path_reachable
vfs: mnt_parent moved to struct mount
vfs: now it can be done - make mnt_parent point to struct mount
vfs: move mnt_mountpoint to struct mount
vfs: spread struct mount - work with counters
vfs: all counters taken to struct mount
vfs: take mnt_child/mnt_mounts to struct mount
vfs: spread struct mount - get_dominating_id / do_make_slave
vfs: spread struct mount - shared subtree iterators
vfs: spread struct mount - propagate_mnt()
vfs: spread struct mount - remaining argument of mnt_set_mountpoint()
vfs: take mnt_master to struct mount
vfs: and now we can make ->mnt_master point to struct mount
vfs: take mnt_share/mnt_slave/mnt_slave_list and mnt_expire to struct mount
vfs: spread struct mount - do_add_mount and graft_tree
vfs: spread struct mount - mntput_no_expire
vfs: mnt_ns moved to struct mount
vfs: mnt_id/mnt_group_id moved
vfs: move the rest of int fields to struct mount
vfs: switch pnode.h macros to struct mount *
vfs: move mnt_list to struct mount
vfs: move mnt_devname
vfs: move fsnotify junk to struct mount
vfs: spread struct mount - remaining argument of next_mnt()
vfs: opencode mntget() mnt_set_mountpoint()
vfs: take /proc/*/mounts and friends to fs/proc_namespace.c switch mnt_namespace ->root to struct mount
vfs: trim includes a bit

Diffstat:

 arch/ia64/kernel/perfmon.c                |    2 +-
 arch/parisc/hpux/sys_hpux.c               |    9 +-
 arch/powerpc/platforms/cell/spufs/inode.c |    1 -
 drivers/staging/pohmelfs/inode.c          |    1 -
 drivers/usb/core/inode.c                  |   11 +-
 fs/9p/vfs_inode.c                         |    1 -
 fs/Makefile                               |    2 +
 fs/affs/super.c                           |    1 -
 fs/afs/mntpt.c                            |    4 +-
 fs/afs/super.c                            |    1 -
 fs/befs/linuxvfs.c                        |    1 -
 fs/bfs/inode.c                            |    1 -
 fs/block_dev.c                            |    8 +-
 fs/btrfs/inode.c                          |    1 -
 fs/btrfs/ioctl.c                          |   22 +-
 fs/btrfs/super.c                          |    1 -
 fs/ceph/inode.c                           |    1 -
 fs/coda/inode.c                           |    1 -
 fs/compat.c                               |    9 +-
 fs/configfs/dir.c                         |    4 +-
 fs/dcache.c                               |   37 +--
 fs/debugfs/inode.c                        |    2 +-
 fs/ecryptfs/super.c                       |    1 -
 fs/efs/super.c                            |    1 -
 fs/exec.c                                 |    2 +-
 fs/exofs/super.c                          |    1 -
 fs/ext2/ioctl.c                           |   12 +-
 fs/ext2/super.c                           |    1 -
 fs/ext3/ioctl.c                           |   20 +-
 fs/ext3/super.c                           |    1 -
 fs/ext4/ioctl.c                           |   28 +-
 fs/ext4/super.c                           |    1 -
 fs/fat/file.c                             |    4 +-
 fs/fat/inode.c                            |    1 -
 fs/fhandle.c                              |    4 +-
 fs/filesystems.c                          |    1 -
 fs/freevxfs/vxfs_inode.c                  |    1 -
 fs/fuse/inode.c                           |    1 -
 fs/gfs2/file.c                            |    4 +-
 fs/gfs2/super.c                           |    1 -
 fs/hfs/super.c                            |    1 -
 fs/hfsplus/ioctl.c                        |    4 +-
 fs/hfsplus/super.c                        |    1 -
 fs/hostfs/hostfs_kern.c                   |    1 -
 fs/hpfs/super.c                           |    1 -
 fs/hppfs/hppfs.c                          |    3 +-
 fs/hugetlbfs/inode.c                      |    1 -
 fs/inode.c                                |    5 +-
 fs/internal.h                             |   27 +-
 fs/isofs/inode.c                          |    1 -
 fs/jffs2/super.c                          |    1 -
 fs/jfs/ioctl.c                            |    4 +-
 fs/jfs/super.c                            |    1 -
 fs/logfs/inode.c                          |    1 -
 fs/minix/inode.c                          |    1 -
 fs/mount.h                                |   75 +++
 fs/namei.c                                |   37 +-
 fs/namespace.c                            |  773 +++++++++++------------------
 fs/ncpfs/inode.c                          |    1 -
 fs/ncpfs/ioctl.c                          |    2 +-
 fs/nfs/dir.c                              |   13 +-
 fs/nfs/inode.c                            |   41 +-
 fs/nfs/super.c                            |   19 +-
 fs/nfsd/nfs4proc.c                        |    4 +-
 fs/nfsd/nfs4recover.c                     |   12 +-
 fs/nfsd/vfs.c                             |   34 +-
 fs/nfsd/vfs.h                             |   10 +
 fs/nilfs2/ioctl.c                         |   22 +-
 fs/nilfs2/super.c                         |    2 -
 fs/notify/fanotify/fanotify_user.c        |    6 +-
 fs/notify/fsnotify.c                      |    9 +-
 fs/notify/vfsmount_mark.c                 |   19 +-
 fs/ntfs/inode.c                           |    1 -
 fs/ocfs2/dlmfs/dlmfs.c                    |    1 -
 fs/ocfs2/ioctl.c                          |    4 +-
 fs/ocfs2/move_extents.c                   |    4 +-
 fs/ocfs2/super.c                          |    1 -
 fs/open.c                                 |    2 +-
 fs/openpromfs/inode.c                     |    1 -
 fs/pipe.c                                 |    7 -
 fs/pnode.c                                |  120 ++---
 fs/pnode.h                                |   36 +-
 fs/proc/base.c                            |  114 -----
 fs/proc/inode.c                           |    1 -
 fs/proc/namespaces.c                      |    1 -
 fs/proc_namespace.c                       |  331 ++++++++++++
 fs/qnx4/inode.c                           |    1 -
 fs/reiserfs/ioctl.c                       |    8 +-
 fs/reiserfs/super.c                       |    1 -
 fs/romfs/super.c                          |    1 -
 fs/seq_file.c                             |   10 +-
 fs/squashfs/super.c                       |    1 -
 fs/statfs.c                               |   21 +-
 fs/super.c                                |   50 ++-
 fs/sysv/inode.c                           |    1 -
 fs/ubifs/ioctl.c                          |    4 +-
 fs/ubifs/super.c                          |    1 -
 fs/udf/super.c                            |    1 -
 fs/ufs/super.c                            |    1 -
 fs/xattr.c                                |    4 +-
 fs/xfs/xfs_iget.c                         |    1 -
 fs/xfs/xfs_ioctl.c                        |    8 +-
 fs/xfs/xfs_ioctl32.c                      |    8 +-
 include/linux/fs.h                        |    7 +-
 include/linux/mnt_namespace.h             |   31 +-
 include/linux/mount.h                     |   39 +--
 include/linux/nfs_fs.h                    |    2 +-
 include/linux/seq_file.h                  |   10 +-
 ipc/mqueue.c                              |    1 -
 kernel/acct.c                             |   40 +--
 mm/shmem.c                                |    1 -
 net/sunrpc/rpc_pipe.c                     |    1 -
 security/apparmor/path.c                  |    1 -
 security/inode.c                          |    2 +-
 security/tomoyo/realpath.c                |    9 +-
 115 files changed, 1067 insertions(+), 1161 deletions(-)
 create mode 100644 fs/mount.h
 create mode 100644 fs/proc_namespace.c
#1 lore raw

Hmm.

Al, Miklos, I just triggered the new inc_link() warning three times in very close succession by just doing a simple

perf record -f -e cycles:pp make -j

(I don't think the "perf record" part was actually required or relevant, although it may have been instrumental in triggering just the right timing)

This was in a fully built tree, I'm just checking

The warning trace looks like this:

  [ 6933.446125] ------------[ cut here ]------------
  [ 6933.446131] WARNING: at fs/inode.c:349 inc_nlink+0x30/0x40()
  [ 6933.446133] Hardware name: System Product Name
  [ 6933.446135] Pid: 22955, comm: perf Not tainted
3.2.0-03190-g972b2c719990 #72
  [ 6933.446137] Call Trace:
  [ 6933.446143]  [<ffffffff8102ee15>] warn_slowpath_common+0x75/0xb0
  [ 6933.446145]  [<ffffffff8102ef15>] warn_slowpath_null+0x15/0x20
  [ 6933.446147]  [<ffffffff810f1450>] inc_nlink+0x30/0x40
  [ 6933.446151]  [<ffffffff8116f333>] ext4_symlink+0x113/0x2c0
  [ 6933.446154]  [<ffffffff810e7b01>] vfs_symlink+0xa1/0xf0
  [ 6933.446157]  [<ffffffff810e7c03>] sys_symlinkat+0xb3/0xd0
  [ 6933.446159]  [<ffffffff810e7c31>] sys_symlink+0x11/0x20
  [ 6933.446162]  [<ffffffff816916a2>] system_call_fastpath+0x16/0x1b
  [ 6933.446164] ---[ end trace 550d4b2eb6b8fbc9 ]---

and the three warnings all triggered within 2/100th of a second of that one (the last one had a timestamp of 6933.465678), so they are probably all related to the same thing happening.

Any ideas?

Linus

author maintainer
#2 lore raw
Quoted 31 lines · Linus Torvalds

Hmm.

Al, Miklos, I just triggered the new inc_link() warning three times in very close succession by just doing a simple

perf record -f -e cycles:pp make -j

(I don't think the "perf record" part was actually required or relevant, although it may have been instrumental in triggering just the right timing)

This was in a fully built tree, I'm just checking

The warning trace looks like this:

  [ 6933.446125] ------------[ cut here ]------------
  [ 6933.446131] WARNING: at fs/inode.c:349 inc_nlink+0x30/0x40()
  [ 6933.446133] Hardware name: System Product Name
  [ 6933.446135] Pid: 22955, comm: perf Not tainted
3.2.0-03190-g972b2c719990 #72
  [ 6933.446137] Call Trace:
  [ 6933.446143]  [<ffffffff8102ee15>] warn_slowpath_common+0x75/0xb0
  [ 6933.446145]  [<ffffffff8102ef15>] warn_slowpath_null+0x15/0x20
  [ 6933.446147]  [<ffffffff810f1450>] inc_nlink+0x30/0x40
  [ 6933.446151]  [<ffffffff8116f333>] ext4_symlink+0x113/0x2c0
  [ 6933.446154]  [<ffffffff810e7b01>] vfs_symlink+0xa1/0xf0
  [ 6933.446157]  [<ffffffff810e7c03>] sys_symlinkat+0xb3/0xd0
  [ 6933.446159]  [<ffffffff810e7c31>] sys_symlink+0x11/0x20
  [ 6933.446162]  [<ffffffff816916a2>] system_call_fastpath+0x16/0x1b
  [ 6933.446164] ---[ end trace 550d4b2eb6b8fbc9 ]---
Quoted 3 lines

and the three warnings all triggered within 2/100th of a second of that one (the last one had a timestamp of 6933.465678), so they are probably all related to the same thing happening.

WTF is ext4_symlink() doing in case of long symlinks? Look:

                drop_nlink(inode);
                err = ext4_orphan_add(handle, inode);
                ext4_journal_stop(handle);
[write symlink body]
                inc_nlink(inode);
                err = ext4_orphan_del(handle, inode);

oh, I see... The comment above that re deadlocks and inability to do that in a single transaction ;-/

OK, try this; that's equivalent to what they are doing and will not WARN_ON(); I hadn't checked other filesystems for similar tricks yet, so this has a good chance of being incomplete.

fs/ext4/namei.c +1 -1
index 86edc45..2043f48 100644
@@ -2315,7 +2315,7 @@ retry:
 			err = PTR_ERR(handle);
 			goto err_drop_inode;
 		}
-		inc_nlink(inode);
+		set_nlink(inode, 1);
 		err = ext4_orphan_del(handle, inode);
 		if (err) {
 			ext4_journal_stop(handle);
author maintainer
#3 lore raw
Quoted 7 lines · Al Viro

WTF is ext4_symlink() doing in case of long symlinks? Look:

                drop_nlink(inode);
                err = ext4_orphan_add(handle, inode);
                ext4_journal_stop(handle);
[write symlink body]
                inc_nlink(inode);
                err = ext4_orphan_del(handle, inode);
Quoted 6 lines

oh, I see... The comment above that re deadlocks and inability to do that in a single transaction ;-/

OK, try this; that's equivalent to what they are doing and will not WARN_ON(); I hadn't checked other filesystems for similar tricks yet, so this has a good chance of being incomplete.

... and sure enough, ext3 has the same piece of fun.

#4 lore raw
Quoted 2 lines · Al Viro

... and sure enough, ext3 has the same piece of fun.

Hmm. Do we want to have the s_remove_count games for this "temporarily zero nlink" case? Maybe we don't want to do drop_nlink/set_nlink? Does it matter?

Anyway, mind sending me a patch with changelog and sign-off?

Linus

author maintainer
#5 lore raw
Quoted 7 lines · Linus Torvalds
Quoted 2 lines · Al Viro

... and sure enough, ext3 has the same piece of fun.

Hmm. Do we want to have the s_remove_count games for this "temporarily zero nlink" case? Maybe we don't want to do drop_nlink/set_nlink? Does it matter?

The thing is, the total result in case of failure should be drop_nlink with s_remove_count bumped. We could turn that into
set i_nlink to 0, without touching s_remove_count write the body
if failed, bump s_remove_count and bugger off otherwise set i_nlink to 1, without touching s_remove_count
but that's far more intrusive change than what I posted.

Quoted 1 line

Anyway, mind sending me a patch with changelog and sign-off?

Sure, will do. I have several more fixes in my tree right now (including such gems as double kfree() in devpts on mount failure ;-/), so I'll send a pull request in a couple of hours anyway. Would you be OK with having that patch in the same pile?

#6 lore raw
Quoted 5 lines · Al Viro

Sure, will do.  I have several more fixes in my tree right now (including such gems as double kfree() in devpts on mount failure ;-/), so I'll send a pull request in a couple of hours anyway.  Would you be OK with having that patch in the same pile?

Sure, no problem.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#7 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 5 lines · Al Viro

Sure, will do. ?I have several more fixes in my tree right now (including such gems as double kfree() in devpts on mount failure ;-/), so I'll send a pull request in a couple of hours anyway. ?Would you be OK with having that patch in the same pile?

Sure, no problem.

OK, there we go, then... This stuff is fixes-only; there'll be another pile with patches from various folks all over the last cycle. Please, pull from the usual place -
git://git.kernel.org:/pub/scm/linux/kernel/git/viro/vfs.git for-linus

Shortlog:
Al Viro (5):
functionfs: unfuck failure exits on mount
... and the same for gadgetfs
devpts: fix double-free on mount failure
exofs: oops after late failure in mount
ext[34]: avoid i_nlink warnings triggered by drop_nlink/inc_nlink kludge in symlink()

Diffstat:

 drivers/usb/gadget/f_fs.c  |   31 +++++++++++--------------------
 drivers/usb/gadget/inode.c |   26 +++++++++++---------------
 fs/devpts/inode.c          |    4 +---
 fs/exofs/super.c           |    2 ++
 fs/ext3/namei.c            |    2 +-
 fs/ext4/namei.c            |    2 +-
 6 files changed, 27 insertions(+), 40 deletions(-)
maintainer Acked-by
#8 lore raw
In reply to Al Viro
Quoted 20 lines · Al Viro

WTF is ext4_symlink() doing in case of long symlinks? Look:

                drop_nlink(inode);
                err = ext4_orphan_add(handle, inode);
                ext4_journal_stop(handle);
[write symlink body]
                inc_nlink(inode);
                err = ext4_orphan_del(handle, inode);

oh, I see... The comment above that re deadlocks and inability to do that in a single transaction ;-/

OK, try this; that's equivalent to what they are doing and will not WARN_ON(); I hadn't checked other filesystems for similar tricks yet, so this has a good chance of being incomplete.

fs/ext4/namei.c +0 -0
index 86edc45..2043f48 100644

fs/ext4/namei.c retry: · line 2321

Quoted 8 lines
fs/ext4/namei.c +1 -1
@@ -2315,7 +2315,7 @@ retry:
 			err = PTR_ERR(handle);
 			goto err_drop_inode;
 		}
-		inc_nlink(inode);
+		set_nlink(inode, 1);
 		err = ext4_orphan_del(handle, inode);
 		if (err) {
 			ext4_journal_stop(handle);

Thanks, looks good to me.

What's there is a bit of kludge, granted. But an attempt to optimize out placing the inode on and off the orphan list (either by deferring the start of the ext3/4 journal handle, or by special casing the block used for the long symlink) would add a lot of complexity, and creating long symlinks is not common case in most workloads...

- Ted

#9 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds

Hmm.

Al, Miklos, I just triggered the new inc_link() warning three times in very close succession by just doing a simple

Also just as expected the set_nlink warnings triggers during XFS log recovery (not that I haven't pointed this out multiple times before):

[ 1702.280003] XFS (vdb2): Starting recovery (logdev: internal)
[ 1702.294935] set_nlink() clearing i_nlink on xfs inode 320
[ 1702.297909] set_nlink() clearing i_nlink on xfs inode 256
[ 1702.301082] set_nlink() clearing i_nlink on xfs inode 192
[ 1702.304305] set_nlink() clearing i_nlink on xfs inode 321
[ 1702.306980] set_nlink() clearing i_nlink on xfs inode 257
[ 1702.308204] set_nlink() clearing i_nlink on xfs inode 193
[ 1702.309490] set_nlink() clearing i_nlink on xfs inode 322
[ 1702.311195] set_nlink() clearing i_nlink on xfs inode 258
[ 1702.313156] set_nlink() clearing i_nlink on xfs inode 194
[ 1702.315203] set_nlink() clearing i_nlink on xfs inode 323
#10 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Linus Torvalds

Hmm.

Al, Miklos, I just triggered the new inc_link() warning three times in very close succession by just doing a simple

Also just as expected the set_nlink warnings triggers during XFS log recovery (not that I haven't pointed this out multiple times before):

Quoted 11 lines
[ 1702.280003] XFS (vdb2): Starting recovery (logdev: internal)
[ 1702.294935] set_nlink() clearing i_nlink on xfs inode 320
[ 1702.297909] set_nlink() clearing i_nlink on xfs inode 256
[ 1702.301082] set_nlink() clearing i_nlink on xfs inode 192
[ 1702.304305] set_nlink() clearing i_nlink on xfs inode 321
[ 1702.306980] set_nlink() clearing i_nlink on xfs inode 257
[ 1702.308204] set_nlink() clearing i_nlink on xfs inode 193
[ 1702.309490] set_nlink() clearing i_nlink on xfs inode 322
[ 1702.311195] set_nlink() clearing i_nlink on xfs inode 258
[ 1702.313156] set_nlink() clearing i_nlink on xfs inode 194
[ 1702.315203] set_nlink() clearing i_nlink on xfs inode 323

There are a couple of options:

a) leave it as it is

b) change that set_nlink() in xfs into a

if (nlink)

	set_nlink(nlink);
  else
	clear_nlink();

c) remove the printk from set_nlink(). This effectively makes set_nlink(0) an alias of clear_nlink().

IIRC your preference is c. What do others think?

Thanks,
Miklos

#11 lore raw
Quoted 7 lines · Miklos Szeredi

There are a couple of options:

a) leave it as it is

b) change that set_nlink() in xfs into a

if (nlink)

Quoted 8 lines
	set_nlink(nlink);
  else
	clear_nlink();

c) remove the printk from set_nlink(). This effectively makes set_nlink(0) an alias of clear_nlink().

IIRC your preference is c. What do others think?

Yes. a) really isn't an option - we don't want to spew thousands of useless messages during a log recovery for an operation that's totally normal. b) is okay, too - but it's not just xfs that needs to be covered, but any fs that support the concept of recovering from open but unlinked inodes after a crash. It's just that no one else seems to have regular QA for that code path.

#12 lore raw
Quoted 15 lines · Christoph Hellwig
Quoted 14 lines · Miklos Szeredi

There are a couple of options:

a) leave it as it is

b) change that set_nlink() in xfs into a

if (nlink)

	set_nlink(nlink);
  else
	clear_nlink();

c) remove the printk from set_nlink(). This effectively makes set_nlink(0) an alias of clear_nlink().

Quoted 8 lines
Quoted 1 line

IIRC your preference is c. What do others think?

Yes. a) really isn't an option - we don't want to spew thousands of useless messages during a log recovery for an operation that's totally normal. b) is okay, too - but it's not just xfs that needs to be covered, but any fs that support the concept of recovering from open but unlinked inodes after a crash. It's just that no one else seems to have regular QA for that code path.

Since it's a ratelimited printk there won't be thousands of messages. I think this is just a cosmetic issue and lack of QA isn't a problem. If the messages are bothersome it can be fixed.

Thanks,
Miklos

maintainer
#13 lore raw
Quoted 10 lines · Miklos Szeredi
Quoted 6 lines

Yes. a) really isn't an option - we don't want to spew thousands of useless messages during a log recovery for an operation that's totally normal. b) is okay, too - but it's not just xfs that needs to be covered, but any fs that support the concept of recovering from open but unlinked inodes after a crash. It's just that no one else seems to have regular QA for that code path.

Since it's a ratelimited printk there won't be thousands of messages. I think this is just a cosmetic issue and lack of QA isn't a problem. If the messages are bothersome it can be fixed.

We're going to spew messages in ext3/4 for orphan inodes as well (thanks for Cristoph for pointing that out). I can put in a similar kludge, but maybe there should be a _set_nlink() that skips the check? We do our own more sophisticated check in and will do appropriate error handling in ext4_iget() anyway, so it's just a waste in that particular codepath anyway.

- Ted

author maintainer
#14 lore raw
Quoted 12 lines · Ted Ts'o
Quoted 10 lines · Miklos Szeredi
Quoted 6 lines

Yes. a) really isn't an option - we don't want to spew thousands of useless messages during a log recovery for an operation that's totally normal. b) is okay, too - but it's not just xfs that needs to be covered, but any fs that support the concept of recovering from open but unlinked inodes after a crash. It's just that no one else seems to have regular QA for that code path.

Since it's a ratelimited printk there won't be thousands of messages. I think this is just a cosmetic issue and lack of QA isn't a problem. If the messages are bothersome it can be fixed.

Quoted 6 lines

We're going to spew messages in ext3/4 for orphan inodes as well (thanks for Cristoph for pointing that out). I can put in a similar kludge, but maybe there should be a _set_nlink() that skips the check? We do our own more sophisticated check in and will do appropriate error handling in ext4_iget() anyway, so it's just a waste in that particular codepath anyway.

Looking at the callers, I'm not sure we want that warning in set_nlink() at all, rate-limited or not. Note that it can trigger on the things like stale NFS fhandle coming in for something that had been deleted a while ago - IOW, it's neither a kernel bug nor fs corruption. inc_nlink - sure, that might catch real bugs, drop_nlink - definitely, but this...

#15 lore raw
Quoted 6 lines · Al Viro

Looking at the callers, I'm not sure we want that warning in set_nlink() at all, rate-limited or not. Note that it can trigger on the things like stale NFS fhandle coming in for something that had been deleted a while ago - IOW, it's neither a kernel bug nor fs corruption. inc_nlink - sure, that might catch real bugs, drop_nlink - definitely, but this...

Patch follows.

Thanks,
Miklos
----

Subject: vfs: remove printk from set_nlink()

From: Miklos Szeredi <[email protected]>

Don't log a message for set_nlink(0).

---
 fs/inode.c |    3 ---
 1 file changed, 3 deletions(-)
fs/inode.c +0 -3
Index: linux-2.6/fs/inode.c
===================================================================
@@ -322,9 +322,6 @@ EXPORT_SYMBOL(clear_nlink);
 void set_nlink(struct inode *inode, unsigned int nlink)
 {
 	if (!nlink) {
-		printk_ratelimited(KERN_INFO
-			"set_nlink() clearing i_nlink on %s inode %li\n",
-			inode->i_sb->s_type->name, inode->i_ino);
 		clear_nlink(inode);
 	} else {
 		/* Yes, some filesystems do change nlink from zero to one */