Commit a63365ea authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jfs.bkbits.net/linux-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 71670f86 2be39ae7
...@@ -123,11 +123,11 @@ int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) ...@@ -123,11 +123,11 @@ int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
} }
/* /*
* __jfs_permission() * jfs_permission()
* *
* modified vfs_permission to check posix acl * modified vfs_permission to check posix acl
*/ */
static int __jfs_permission(struct inode * inode, int mask, int have_sem) int jfs_permission(struct inode * inode, int mask, struct nameidata *nd)
{ {
umode_t mode = inode->i_mode; umode_t mode = inode->i_mode;
struct jfs_inode_info *ji = JFS_IP(inode); struct jfs_inode_info *ji = JFS_IP(inode);
...@@ -161,11 +161,7 @@ static int __jfs_permission(struct inode * inode, int mask, int have_sem) ...@@ -161,11 +161,7 @@ static int __jfs_permission(struct inode * inode, int mask, int have_sem)
if (ji->i_acl == JFS_ACL_NOT_CACHED) { if (ji->i_acl == JFS_ACL_NOT_CACHED) {
struct posix_acl *acl; struct posix_acl *acl;
if (!have_sem)
down(&inode->i_sem);
acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
if (!have_sem)
up(&inode->i_sem);
if (IS_ERR(acl)) if (IS_ERR(acl))
return PTR_ERR(acl); return PTR_ERR(acl);
...@@ -208,14 +204,6 @@ static int __jfs_permission(struct inode * inode, int mask, int have_sem) ...@@ -208,14 +204,6 @@ static int __jfs_permission(struct inode * inode, int mask, int have_sem)
return -EACCES; return -EACCES;
} }
int jfs_permission(struct inode * inode, int mask, struct nameidata *nd)
{
return __jfs_permission(inode, mask, 0);
}
int jfs_permission_have_sem(struct inode * inode, int mask)
{
return __jfs_permission(inode, mask, 1);
}
int jfs_init_acl(struct inode *inode, struct inode *dir) int jfs_init_acl(struct inode *inode, struct inode *dir)
{ {
......
...@@ -105,7 +105,7 @@ int jfs_commit_inode(struct inode *inode, int wait) ...@@ -105,7 +105,7 @@ int jfs_commit_inode(struct inode *inode, int wait)
rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);
txEnd(tid); txEnd(tid);
up(&JFS_IP(inode)->commit_sem); up(&JFS_IP(inode)->commit_sem);
return -rc; return rc;
} }
void jfs_write_inode(struct inode *inode, int wait) void jfs_write_inode(struct inode *inode, int wait)
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
struct posix_acl *jfs_get_acl(struct inode *, int); struct posix_acl *jfs_get_acl(struct inode *, int);
int jfs_set_acl(struct inode *, int, struct posix_acl *); int jfs_set_acl(struct inode *, int, struct posix_acl *);
int jfs_permission_have_sem(struct inode *, int);
int jfs_permission(struct inode *, int, struct nameidata *); int jfs_permission(struct inode *, int, struct nameidata *);
int jfs_init_acl(struct inode *, struct inode *); int jfs_init_acl(struct inode *, struct inode *);
int jfs_setattr(struct dentry *, struct iattr *); int jfs_setattr(struct dentry *, struct iattr *);
......
...@@ -1328,7 +1328,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, ...@@ -1328,7 +1328,7 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
rbn = addressPXD(pxd); rbn = addressPXD(pxd);
rmp = get_metapage(ip, rbn, PSIZE, 1); rmp = get_metapage(ip, rbn, PSIZE, 1);
if (rmp == NULL) if (rmp == NULL)
return EIO; return -EIO;
jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
......
...@@ -67,6 +67,8 @@ struct jfs_inode_info { ...@@ -67,6 +67,8 @@ struct jfs_inode_info {
* inode is blocked in txBegin or TxBeginAnon * inode is blocked in txBegin or TxBeginAnon
*/ */
struct semaphore commit_sem; struct semaphore commit_sem;
/* xattr_sem allows us to access the xattrs without taking i_sem */
struct rw_semaphore xattr_sem;
lid_t xtlid; /* lid of xtree lock on directory */ lid_t xtlid; /* lid of xtree lock on directory */
#ifdef CONFIG_JFS_POSIX_ACL #ifdef CONFIG_JFS_POSIX_ACL
struct posix_acl *i_acl; struct posix_acl *i_acl;
......
...@@ -1615,7 +1615,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate) ...@@ -1615,7 +1615,7 @@ static int lmLogFileSystem(struct jfs_log * log, char *uuid, int activate)
if (i == MAX_ACTIVE) { if (i == MAX_ACTIVE) {
jfs_warn("Too many file systems sharing journal!"); jfs_warn("Too many file systems sharing journal!");
lbmFree(bpsuper); lbmFree(bpsuper);
return EMFILE; /* Is there a better rc? */ return -EMFILE; /* Is there a better rc? */
} }
} else { } else {
for (i = 0; i < MAX_ACTIVE; i++) for (i = 0; i < MAX_ACTIVE; i++)
......
...@@ -178,7 +178,7 @@ void inlineLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, ...@@ -178,7 +178,7 @@ void inlineLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
struct tlock * tlck); struct tlock * tlck);
void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
struct tlock * tlck); struct tlock * tlck);
void txAbortCommit(struct commit * cd, int exval); static void txAbortCommit(struct commit * cd);
static void txAllocPMap(struct inode *ip, struct maplock * maplock, static void txAllocPMap(struct inode *ip, struct maplock * maplock,
struct tblock * tblk); struct tblock * tblk);
void txForce(struct tblock * tblk); void txForce(struct tblock * tblk);
...@@ -1113,7 +1113,7 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1113,7 +1113,7 @@ int txCommit(tid_t tid, /* transaction identifier */
jfs_info("txCommit, tid = %d, flag = %d", tid, flag); jfs_info("txCommit, tid = %d, flag = %d", tid, flag);
/* is read-only file system ? */ /* is read-only file system ? */
if (isReadOnly(iplist[0])) { if (isReadOnly(iplist[0])) {
rc = EROFS; rc = -EROFS;
goto TheEnd; goto TheEnd;
} }
...@@ -1317,7 +1317,7 @@ int txCommit(tid_t tid, /* transaction identifier */ ...@@ -1317,7 +1317,7 @@ int txCommit(tid_t tid, /* transaction identifier */
out: out:
if (rc != 0) if (rc != 0)
txAbortCommit(&cd, rc); txAbortCommit(&cd);
TheEnd: TheEnd:
jfs_info("txCommit: tid = %d, returning %d", tid, rc); jfs_info("txCommit: tid = %d, returning %d", tid, rc);
...@@ -2672,14 +2672,13 @@ void txAbort(tid_t tid, int dirty) ...@@ -2672,14 +2672,13 @@ void txAbort(tid_t tid, int dirty)
* log age of page-frames in memory for which caller has * log age of page-frames in memory for which caller has
* are reset to 0 (to avoid logwarap). * are reset to 0 (to avoid logwarap).
*/ */
void txAbortCommit(struct commit * cd, int exval) static void txAbortCommit(struct commit * cd)
{ {
struct tblock *tblk; struct tblock *tblk;
tid_t tid; tid_t tid;
lid_t lid, next; lid_t lid, next;
struct metapage *mp; struct metapage *mp;
assert(exval == EIO || exval == ENOMEM);
jfs_warn("txAbortCommit: cd:0x%p", cd); jfs_warn("txAbortCommit: cd:0x%p", cd);
/* /*
......
...@@ -120,7 +120,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode, ...@@ -120,7 +120,7 @@ int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
jfs_err("jfs_create: dtInsert returned %d", rc); jfs_err("jfs_create: dtInsert returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks Filesystem dirty */ txAbort(tid, 1); /* Marks Filesystem dirty */
else else
txAbort(tid, 0); /* Filesystem full */ txAbort(tid, 0); /* Filesystem full */
...@@ -247,7 +247,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) ...@@ -247,7 +247,7 @@ int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
jfs_err("jfs_mkdir: dtInsert returned %d", rc); jfs_err("jfs_mkdir: dtInsert returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks Filesystem dirty */ txAbort(tid, 1); /* Marks Filesystem dirty */
else else
txAbort(tid, 0); /* Filesystem full */ txAbort(tid, 0); /* Filesystem full */
...@@ -353,7 +353,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry) ...@@ -353,7 +353,7 @@ int jfs_rmdir(struct inode *dip, struct dentry *dentry)
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) {
jfs_err("jfs_rmdir: dtDelete returned %d", rc); jfs_err("jfs_rmdir: dtDelete returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); txAbort(tid, 1);
txEnd(tid); txEnd(tid);
up(&JFS_IP(dip)->commit_sem); up(&JFS_IP(dip)->commit_sem);
...@@ -469,7 +469,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -469,7 +469,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
ino = ip->i_ino; ino = ip->i_ino;
if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) {
jfs_err("jfs_unlink: dtDelete returned %d", rc); jfs_err("jfs_unlink: dtDelete returned %d", rc);
if (rc == EIO) if (rc == -EIO)
txAbort(tid, 1); /* Marks FS Dirty */ txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid); txEnd(tid);
up(&JFS_IP(dip)->commit_sem); up(&JFS_IP(dip)->commit_sem);
...@@ -535,7 +535,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry) ...@@ -535,7 +535,7 @@ int jfs_unlink(struct inode *dip, struct dentry *dentry)
new_size = xtTruncate_pmap(tid, ip, new_size); new_size = xtTruncate_pmap(tid, ip, new_size);
if (new_size < 0) { if (new_size < 0) {
txAbort(tid, 1); /* Marks FS Dirty */ txAbort(tid, 1); /* Marks FS Dirty */
rc = -new_size; /* We return -rc */ rc = new_size;
} else } else
rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC); rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC);
txEnd(tid); txEnd(tid);
......
...@@ -382,6 +382,7 @@ static void jfs_write_super_lockfs(struct super_block *sb) ...@@ -382,6 +382,7 @@ static void jfs_write_super_lockfs(struct super_block *sb)
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
txQuiesce(sb); txQuiesce(sb);
lmLogShutdown(log); lmLogShutdown(log);
updateSuper(sb, FM_CLEAN);
} }
} }
...@@ -392,6 +393,7 @@ static void jfs_unlockfs(struct super_block *sb) ...@@ -392,6 +393,7 @@ static void jfs_unlockfs(struct super_block *sb)
int rc = 0; int rc = 0;
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
updateSuper(sb, FM_MOUNT);
if ((rc = lmLogInit(log))) if ((rc = lmLogInit(log)))
jfs_err("jfs_unlock failed with return code %d", rc); jfs_err("jfs_unlock failed with return code %d", rc);
else else
...@@ -457,6 +459,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) ...@@ -457,6 +459,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
INIT_LIST_HEAD(&jfs_ip->anon_inode_list); INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
init_rwsem(&jfs_ip->rdwrlock); init_rwsem(&jfs_ip->rdwrlock);
init_MUTEX(&jfs_ip->commit_sem); init_MUTEX(&jfs_ip->commit_sem);
init_rwsem(&jfs_ip->xattr_sem);
jfs_ip->atlhead = 0; jfs_ip->atlhead = 0;
jfs_ip->active_ag = -1; jfs_ip->active_ag = -1;
#ifdef CONFIG_JFS_POSIX_ACL #ifdef CONFIG_JFS_POSIX_ACL
......
...@@ -729,7 +729,7 @@ static int can_set_xattr(struct inode *inode, const char *name, ...@@ -729,7 +729,7 @@ static int can_set_xattr(struct inode *inode, const char *name,
return -EPERM; return -EPERM;
#ifdef CONFIG_JFS_POSIX_ACL #ifdef CONFIG_JFS_POSIX_ACL
return jfs_permission_have_sem(inode, MAY_WRITE); return jfs_permission(inode, MAY_WRITE, NULL);
#else #else
return permission(inode, MAY_WRITE, NULL); return permission(inode, MAY_WRITE, NULL);
#endif #endif
...@@ -763,6 +763,8 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value, ...@@ -763,6 +763,8 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
namelen -= XATTR_OS2_PREFIX_LEN; namelen -= XATTR_OS2_PREFIX_LEN;
} }
down_write(&JFS_IP(inode)->xattr_sem);
xattr_size = ea_get(inode, &ea_buf, 0); xattr_size = ea_get(inode, &ea_buf, 0);
if (xattr_size < 0) { if (xattr_size < 0) {
rc = xattr_size; rc = xattr_size;
...@@ -868,6 +870,8 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value, ...@@ -868,6 +870,8 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
release: release:
ea_release(inode, &ea_buf); ea_release(inode, &ea_buf);
out: out:
up_write(&JFS_IP(inode)->xattr_sem);
if (os2name) if (os2name)
kfree(os2name); kfree(os2name);
...@@ -890,8 +894,7 @@ static int can_get_xattr(struct inode *inode, const char *name) ...@@ -890,8 +894,7 @@ static int can_get_xattr(struct inode *inode, const char *name)
#ifdef CONFIG_JFS_POSIX_ACL #ifdef CONFIG_JFS_POSIX_ACL
if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0) if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0)
return 0; return 0;
else return jfs_permission(inode, MAY_READ, NULL);
return jfs_permission_have_sem(inode, MAY_READ);
#else #else
return permission(inode, MAY_READ, NULL); return permission(inode, MAY_READ, NULL);
#endif #endif
...@@ -923,7 +926,10 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, ...@@ -923,7 +926,10 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
namelen -= XATTR_OS2_PREFIX_LEN; namelen -= XATTR_OS2_PREFIX_LEN;
} }
down_read(&JFS_IP(inode)->xattr_sem);
xattr_size = ea_get(inode, &ea_buf, 0); xattr_size = ea_get(inode, &ea_buf, 0);
if (xattr_size < 0) { if (xattr_size < 0) {
size = xattr_size; size = xattr_size;
goto out; goto out;
...@@ -955,6 +961,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, ...@@ -955,6 +961,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
release: release:
ea_release(inode, &ea_buf); ea_release(inode, &ea_buf);
out: out:
up_read(&JFS_IP(inode)->xattr_sem);
if (os2name) if (os2name)
kfree(os2name); kfree(os2name);
...@@ -966,15 +974,12 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data, ...@@ -966,15 +974,12 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
{ {
int err; int err;
down(&dentry->d_inode->i_sem);
err = __jfs_getxattr(dentry->d_inode, name, data, buf_size); err = __jfs_getxattr(dentry->d_inode, name, data, buf_size);
up(&dentry->d_inode->i_sem);
return err; return err;
} }
static ssize_t __jfs_listxattr(struct dentry * dentry, char *data, ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size)
size_t buf_size)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
char *buffer; char *buffer;
...@@ -984,6 +989,8 @@ static ssize_t __jfs_listxattr(struct dentry * dentry, char *data, ...@@ -984,6 +989,8 @@ static ssize_t __jfs_listxattr(struct dentry * dentry, char *data,
struct jfs_ea *ea; struct jfs_ea *ea;
struct ea_buffer ea_buf; struct ea_buffer ea_buf;
down_read(&JFS_IP(inode)->xattr_sem);
xattr_size = ea_get(inode, &ea_buf, 0); xattr_size = ea_get(inode, &ea_buf, 0);
if (xattr_size < 0) { if (xattr_size < 0) {
size = xattr_size; size = xattr_size;
...@@ -1017,20 +1024,10 @@ static ssize_t __jfs_listxattr(struct dentry * dentry, char *data, ...@@ -1017,20 +1024,10 @@ static ssize_t __jfs_listxattr(struct dentry * dentry, char *data,
release: release:
ea_release(inode, &ea_buf); ea_release(inode, &ea_buf);
out: out:
up_read(&JFS_IP(inode)->xattr_sem);
return size; return size;
} }
ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size)
{
int err;
down(&dentry->d_inode->i_sem);
err = __jfs_listxattr(dentry, data, buf_size);
up(&dentry->d_inode->i_sem);
return err;
}
int jfs_removexattr(struct dentry *dentry, const char *name) int jfs_removexattr(struct dentry *dentry, const char *name)
{ {
return __jfs_setxattr(dentry->d_inode, name, 0, 0, XATTR_REPLACE); return __jfs_setxattr(dentry->d_inode, name, 0, 0, XATTR_REPLACE);
......
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