ceph: don't take inode lock in llseek
PATCH 1/1 ceph: don't take inode lock in llseek
There's no reason we need to lock the inode for write in order to handle an llseek. I suspect this should have been dropped in 2013 when we stopped doing vmtruncate in llseek.
--- fs/ceph/file.c | 3 --- 1 file changed, 3 deletions(-)
fs/ceph/file.c +0 -3
@@ -1994,8 +1994,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)loff_t i_size;loff_t ret; -inode_lock (inode); -if (whence ==SEEK_END || whence ==SEEK_DATA || whence ==SEEK_HOLE ) { ret =ceph_do_getattr (inode,CEPH_STAT_CAP_SIZE , false);if (ret <0 )
@@ -2038,7 +2036,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) ret =vfs_setpos (file, offset,max (i_size, fsc->max_file_size)); out: -inode_unlock (inode);return ret; }
Signature · 1 line
2.36.1
Quoted 24 lines · Jeff Layton
There's no reason we need to lock the inode for write in order to handle an llseek. I suspect this should have been dropped in 2013 when we stopped doing vmtruncate in llseek.
Fixes b0d7c2231015 (ceph: introduce i_truncate_mutex)Signed-off-by Jeff Layton <[email protected]>--- fs/ceph/file.c | 3 --- 1 file changed, 3 deletions(-)fs/ceph/file.c +0
-2@@ -1994,8 +1994,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)loff_t i_size;loff_t ret; -inode_lock (inode); -if (whence ==SEEK_END || whence ==SEEK_DATA || whence ==SEEK_HOLE ) { ret =ceph_do_getattr (inode,CEPH_STAT_CAP_SIZE , false);if (ret <0 )
fs/ceph/file.c static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) · line 2041
Quoted 7 lines
fs/ceph/file.c +0
-1@@ -2038,7 +2036,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) ret =vfs_setpos (file, offset,max (i_size, fsc->max_file_size)); out: -inode_unlock (inode);return ret; }
Looks good.
It seems the 'out' lable makes no sense anymore ?
-- Xiubo
Quoted 35 lines · Xiubo Li
Quoted 24 lines · Jeff Layton
There's no reason we need to lock the inode for write in order to handle an llseek. I suspect this should have been dropped in 2013 when we stopped doing vmtruncate in llseek.
Fixes b0d7c2231015 (ceph: introduce i_truncate_mutex)Signed-off-by Jeff Layton <[email protected]>--- fs/ceph/file.c | 3 --- 1 file changed, 3 deletions(-)fs/ceph/file.c +0
-2@@ -1994,8 +1994,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)loff_t i_size;loff_t ret; -inode_lock (inode); -if (whence ==SEEK_END || whence ==SEEK_DATA || whence ==SEEK_HOLE ) { ret =ceph_do_getattr (inode,CEPH_STAT_CAP_SIZE , false);if (ret <0 )fs/ceph/file.c static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) · line 2041
Quoted 7 lines
fs/ceph/file.c +0
-1@@ -2038,7 +2036,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) ret =vfs_setpos (file, offset,max (i_size, fsc->max_file_size)); out: -inode_unlock (inode);return ret; }Looks good.
Quoted 4 lines
It seems the 'out' lable makes no sense anymore ?
-- Xiubo
No, it's still used if the getattr errors out.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 35 lines · Jeff Layton
Quoted 34 lines · Xiubo Li
Quoted 24 lines · Jeff Layton
There's no reason we need to lock the inode for write in order to handle an llseek. I suspect this should have been dropped in 2013 when we stopped doing vmtruncate in llseek.
Fixes b0d7c2231015 (ceph: introduce i_truncate_mutex)Signed-off-by Jeff Layton <[email protected]>--- fs/ceph/file.c | 3 --- 1 file changed, 3 deletions(-)fs/ceph/file.c +0
-2@@ -1994,8 +1994,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)loff_t i_size;loff_t ret; -inode_lock (inode); -if (whence ==SEEK_END || whence ==SEEK_DATA || whence ==SEEK_HOLE ) { ret =ceph_do_getattr (inode,CEPH_STAT_CAP_SIZE , false);if (ret <0 )fs/ceph/file.c static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) · line 2041
Quoted 7 lines
fs/ceph/file.c +0
-1@@ -2038,7 +2036,6 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) ret =vfs_setpos (file, offset,max (i_size, fsc->max_file_size)); out: -inode_unlock (inode);return ret; }Looks good.
Quoted 5 lines
Quoted 4 lines
It seems the 'out' lable makes no sense anymore ?
-- Xiubo
No, it's still used if the getattr errors out.
Yeah, I mean just return the error directly instead of doing 'goto out'.