sysfs: fix race between readdir and lseek
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thanks to Jiri Kosina et al...
See the reasons below.
Quoted 45 lines · Jiri Kosina
From: Jiri Kosina <[email protected]>
Subject: [PATCH 3.0-stable] Revert "sysfs: fix race between readdir and lseek"This reverts commit
991f76f837bf22c5bb07261cfd86525a0a96650c.It depends on
ef3d0fd27e90f("vfs: do (nearly) locklessgeneric_file_llseek") which is available only in 3.2+.When applied on 3.0 codebase, it causes A-A deadlock, whenever anyone does
seek()on sysfs, as bothgeneric_file_llseek()andsysfs_dir_llseek()obtaini_mutex.Signed-off-by Jiri Kosina <[email protected]>--- fs/sysfs/dir.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)Index:
linux-3.0-SLE11-SP3-sysfs-hang-debug/fs/sysfs/dir.c
===================================================================fs/sysfs/dir.c +1
-13@@ -961,21 +961,9 @@ static int sysfs_readdir(struct file * freturn 0 ; } -static loff_t sysfs_dir_llseek (struct file *file,loff_t offset,int whence) -{ -struct inode *inode = file->f_path.dentry->d_inode; -loff_t ret; - -mutex_lock (&inode->i_mutex); - ret =generic_file_llseek (file, offset, whence); -mutex_unlock (&inode->i_mutex); - -return ret; -} -const struct file_operations sysfs_dir_operations = { .read = generic_read_dir, .readdir = sysfs_readdir, .release = sysfs_dir_release, - .llseek = sysfs_dir_llseek, + .llseek = generic_file_llseek, };
Signature · 2 lines
js suse labs