Commit 6b76d569 authored by Nathan Scott's avatar Nathan Scott Committed by Jaroslav Kysela

[PATCH] xattr locking

This is a patch from Andreas Gruenbacher (the ext2/ext3 EA patch
maintainer) which converts the extended attribute VFS code from
using the BKL to instead use the inode semaphore; please apply.
parent 6da71acc
...@@ -69,10 +69,10 @@ setattr: no yes ...@@ -69,10 +69,10 @@ setattr: no yes
permission: yes no permission: yes no
getattr: (see below) getattr: (see below)
revalidate: no (see below) revalidate: no (see below)
setxattr: yes no setxattr: no yes
getxattr: yes no getxattr: no yes
listxattr: yes no listxattr: no yes
removexattr: yes no removexattr: no yes
Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_sem on Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_sem on
victim. victim.
cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
......
...@@ -84,9 +84,9 @@ setxattr(struct dentry *d, char *name, void *value, size_t size, int flags) ...@@ -84,9 +84,9 @@ setxattr(struct dentry *d, char *name, void *value, size_t size, int flags)
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->setxattr) { if (d->d_inode->i_op && d->d_inode->i_op->setxattr) {
lock_kernel(); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->setxattr(d, kname, kvalue, size, flags); error = d->d_inode->i_op->setxattr(d, kname, kvalue, size, flags);
unlock_kernel(); up(&d->d_inode->i_sem);
} }
xattr_free(kvalue, size); xattr_free(kvalue, size);
...@@ -157,9 +157,9 @@ getxattr(struct dentry *d, char *name, void *value, size_t size) ...@@ -157,9 +157,9 @@ getxattr(struct dentry *d, char *name, void *value, size_t size)
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->getxattr) { if (d->d_inode->i_op && d->d_inode->i_op->getxattr) {
lock_kernel(); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->getxattr(d, kname, kvalue, size); error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
unlock_kernel(); up(&d->d_inode->i_sem);
} }
if (kvalue && error > 0) if (kvalue && error > 0)
...@@ -226,9 +226,9 @@ listxattr(struct dentry *d, char *list, size_t size) ...@@ -226,9 +226,9 @@ listxattr(struct dentry *d, char *list, size_t size)
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->listxattr) { if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
lock_kernel(); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->listxattr(d, klist, size); error = d->d_inode->i_op->listxattr(d, klist, size);
unlock_kernel(); up(&d->d_inode->i_sem);
} }
if (klist && error > 0) if (klist && error > 0)
...@@ -297,9 +297,9 @@ removexattr(struct dentry *d, char *name) ...@@ -297,9 +297,9 @@ removexattr(struct dentry *d, char *name)
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
if (d->d_inode->i_op && d->d_inode->i_op->removexattr) { if (d->d_inode->i_op && d->d_inode->i_op->removexattr) {
lock_kernel(); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->removexattr(d, kname); error = d->d_inode->i_op->removexattr(d, kname);
unlock_kernel(); up(&d->d_inode->i_sem);
} }
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment