Skip to content

Commit

Permalink
Merge branch 'for-linus' from kernel.org:/.../shaggy/jfs-2.6 manually
Browse files Browse the repository at this point in the history
Clash due to new delete_inode behavior (the filesystem now needs to do
the truncate_inode_pages() call itself).

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Linus Torvalds committed Sep 11, 2005
2 parents ce1289a + 1d15b10 commit 3298369
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 62 deletions.
24 changes: 17 additions & 7 deletions fs/jfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/quotaops.h>
#include <linux/posix_acl_xattr.h>
#include "jfs_incore.h"
#include "jfs_txnmgr.h"
#include "jfs_xattr.h"
#include "jfs_acl.h"

Expand Down Expand Up @@ -75,7 +76,8 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
return acl;
}

static int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
static int jfs_set_acl(tid_t tid, struct inode *inode, int type,
struct posix_acl *acl)
{
char *ea_name;
struct jfs_inode_info *ji = JFS_IP(inode);
Expand Down Expand Up @@ -110,7 +112,7 @@ static int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
if (rc < 0)
goto out;
}
rc = __jfs_setxattr(inode, ea_name, value, size, 0);
rc = __jfs_setxattr(tid, inode, ea_name, value, size, 0);
out:
kfree(value);

Expand Down Expand Up @@ -143,7 +145,7 @@ int jfs_permission(struct inode *inode, int mask, struct nameidata *nd)
return generic_permission(inode, mask, jfs_check_acl);
}

int jfs_init_acl(struct inode *inode, struct inode *dir)
int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
{
struct posix_acl *acl = NULL;
struct posix_acl *clone;
Expand All @@ -159,7 +161,7 @@ int jfs_init_acl(struct inode *inode, struct inode *dir)

if (acl) {
if (S_ISDIR(inode->i_mode)) {
rc = jfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
rc = jfs_set_acl(tid, inode, ACL_TYPE_DEFAULT, acl);
if (rc)
goto cleanup;
}
Expand All @@ -173,7 +175,8 @@ int jfs_init_acl(struct inode *inode, struct inode *dir)
if (rc >= 0) {
inode->i_mode = mode;
if (rc > 0)
rc = jfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS,
clone);
}
posix_acl_release(clone);
cleanup:
Expand Down Expand Up @@ -202,8 +205,15 @@ static int jfs_acl_chmod(struct inode *inode)
return -ENOMEM;

rc = posix_acl_chmod_masq(clone, inode->i_mode);
if (!rc)
rc = jfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
if (!rc) {
tid_t tid = txBegin(inode->i_sb, 0);
down(&JFS_IP(inode)->commit_sem);
rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
if (!rc)
rc = txCommit(tid, 1, &inode, 0);
txEnd(tid);
up(&JFS_IP(inode)->commit_sem);
}

posix_acl_release(clone);
return rc;
Expand Down
26 changes: 13 additions & 13 deletions fs/jfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,23 @@ void jfs_delete_inode(struct inode *inode)
{
jfs_info("In jfs_delete_inode, inode = 0x%p", inode);

if (is_bad_inode(inode) ||
(JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
return;
if (!is_bad_inode(inode) &&
(JFS_IP(inode)->fileset == cpu_to_le32(FILESYSTEM_I))) {

truncate_inode_pages(&inode->i_data, 0);
truncate_inode_pages(&inode->i_data, 0);

if (test_cflag(COMMIT_Freewmap, inode))
jfs_free_zero_link(inode);
if (test_cflag(COMMIT_Freewmap, inode))
jfs_free_zero_link(inode);

diFree(inode);
diFree(inode);

/*
* Free the inode from the quota allocation.
*/
DQUOT_INIT(inode);
DQUOT_FREE_INODE(inode);
DQUOT_DROP(inode);
/*
* Free the inode from the quota allocation.
*/
DQUOT_INIT(inode);
DQUOT_FREE_INODE(inode);
DQUOT_DROP(inode);
}

clear_inode(inode);
}
Expand Down
12 changes: 10 additions & 2 deletions fs/jfs/jfs_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@
#ifdef CONFIG_JFS_POSIX_ACL

int jfs_permission(struct inode *, int, struct nameidata *);
int jfs_init_acl(struct inode *, struct inode *);
int jfs_init_acl(tid_t, struct inode *, struct inode *);
int jfs_setattr(struct dentry *, struct iattr *);

#endif /* CONFIG_JFS_POSIX_ACL */
#else

static inline int jfs_init_acl(tid_t tid, struct inode *inode,
struct inode *dir)
{
return 0;
}

#endif
#endif /* _H_JFS_ACL */
14 changes: 12 additions & 2 deletions fs/jfs/jfs_xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ struct jfs_ea_list {
#define END_EALIST(ealist) \
((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))

extern int __jfs_setxattr(struct inode *, const char *, const void *, size_t,
int);
extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
size_t, int);
extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
int);
extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
extern int jfs_removexattr(struct dentry *, const char *);

#ifdef CONFIG_JFS_SECURITY
extern int jfs_init_security(tid_t, struct inode *, struct inode *);
#else
static inline int jfs_init_security(tid_t tid, struct inode *inode,
struct inode *dir)
{
return 0;
}
#endif

#endif /* H_JFS_XATTR */
85 changes: 64 additions & 21 deletions fs/jfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ struct dentry_operations jfs_ci_dentry_operations;

static s64 commitZeroLink(tid_t, struct inode *);

/*
* NAME: free_ea_wmap(inode)
*
* FUNCTION: free uncommitted extended attributes from working map
*
*/
static inline void free_ea_wmap(struct inode *inode)
{
dxd_t *ea = &JFS_IP(inode)->ea;

if (ea->flag & DXD_EXTENT) {
/* free EA pages from cache */
invalidate_dxd_metapages(inode, *ea);
dbFree(inode, addressDXD(ea), lengthDXD(ea));
}
ea->flag = 0;
}

/*
* NAME: jfs_create(dip, dentry, mode)
*
Expand Down Expand Up @@ -89,8 +107,19 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
down(&JFS_IP(dip)->commit_sem);
down(&JFS_IP(ip)->commit_sem);

rc = jfs_init_acl(tid, ip, dip);
if (rc)
goto out3;

rc = jfs_init_security(tid, ip, dip);
if (rc) {
txAbort(tid, 0);
goto out3;
}

if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
jfs_err("jfs_create: dtSearch returned %d", rc);
txAbort(tid, 0);
goto out3;
}

Expand Down Expand Up @@ -139,6 +168,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
up(&JFS_IP(dip)->commit_sem);
up(&JFS_IP(ip)->commit_sem);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
iput(ip);
} else
Expand All @@ -147,11 +177,6 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
out2:
free_UCSname(&dname);

#ifdef CONFIG_JFS_POSIX_ACL
if (rc == 0)
jfs_init_acl(ip, dip);
#endif

out1:

jfs_info("jfs_create: rc:%d", rc);
Expand Down Expand Up @@ -216,8 +241,19 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
down(&JFS_IP(dip)->commit_sem);
down(&JFS_IP(ip)->commit_sem);

rc = jfs_init_acl(tid, ip, dip);
if (rc)
goto out3;

rc = jfs_init_security(tid, ip, dip);
if (rc) {
txAbort(tid, 0);
goto out3;
}

if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
jfs_err("jfs_mkdir: dtSearch returned %d", rc);
txAbort(tid, 0);
goto out3;
}

Expand Down Expand Up @@ -267,6 +303,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
up(&JFS_IP(dip)->commit_sem);
up(&JFS_IP(ip)->commit_sem);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
iput(ip);
} else
Expand All @@ -275,10 +312,6 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
out2:
free_UCSname(&dname);

#ifdef CONFIG_JFS_POSIX_ACL
if (rc == 0)
jfs_init_acl(ip, dip);
#endif

out1:

Expand Down Expand Up @@ -885,6 +918,10 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
down(&JFS_IP(dip)->commit_sem);
down(&JFS_IP(ip)->commit_sem);

rc = jfs_init_security(tid, ip, dip);
if (rc)
goto out3;

tblk = tid_to_tblock(tid);
tblk->xflag |= COMMIT_CREATE;
tblk->ino = ip->i_ino;
Expand Down Expand Up @@ -1000,6 +1037,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
up(&JFS_IP(dip)->commit_sem);
up(&JFS_IP(ip)->commit_sem);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
iput(ip);
} else
Expand All @@ -1008,11 +1046,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
out2:
free_UCSname(&dname);

#ifdef CONFIG_JFS_POSIX_ACL
if (rc == 0)
jfs_init_acl(ip, dip);
#endif

out1:
jfs_info("jfs_symlink: rc:%d", rc);
return rc;
Expand Down Expand Up @@ -1328,17 +1361,31 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
down(&JFS_IP(dir)->commit_sem);
down(&JFS_IP(ip)->commit_sem);

if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE)))
rc = jfs_init_acl(tid, ip, dir);
if (rc)
goto out3;

rc = jfs_init_security(tid, ip, dir);
if (rc) {
txAbort(tid, 0);
goto out3;
}

if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) {
txAbort(tid, 0);
goto out3;
}

tblk = tid_to_tblock(tid);
tblk->xflag |= COMMIT_CREATE;
tblk->ino = ip->i_ino;
tblk->u.ixpxd = JFS_IP(ip)->ixpxd;

ino = ip->i_ino;
if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack)))
if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) {
txAbort(tid, 0);
goto out3;
}

ip->i_op = &jfs_file_inode_operations;
jfs_ip->dev = new_encode_dev(rdev);
Expand All @@ -1360,6 +1407,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
up(&JFS_IP(ip)->commit_sem);
up(&JFS_IP(dir)->commit_sem);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
iput(ip);
} else
Expand All @@ -1368,11 +1416,6 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
out1:
free_UCSname(&dname);

#ifdef CONFIG_JFS_POSIX_ACL
if (rc == 0)
jfs_init_acl(ip, dir);
#endif

out:
jfs_info("jfs_mknod: returning %d", rc);
return rc;
Expand Down
Loading

0 comments on commit 3298369

Please sign in to comment.