Commit 4a93d6e8 authored by Nathan Scott's avatar Nathan Scott Committed by Stephen Lord

[XFS] Alternate, cleaner fix for the ENOSPC/ACL lookup problem

SGI Modid: 2.5.x-xfs:slinx:157531a
parent 487d7c62
......@@ -65,7 +65,6 @@ xfs-$(CONFIG_SYSCTL) += linux/xfs_sysctl.o
xfs-y += xfs_alloc.o \
xfs_alloc_btree.o \
xfs_attr.o \
xfs_attr_fetch.o \
xfs_attr_leaf.o \
xfs_bit.o \
xfs_bmap.o \
......
......@@ -116,38 +116,38 @@ ktrace_t *xfs_attr_trace_buf;
*========================================================================*/
/*ARGSUSED*/
int /* error */
xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp,
int flags, struct cred *cred)
STATIC int
xfs_attr_get_int(xfs_inode_t *ip, char *name, char *value, int *valuelenp,
int flags, int lock, struct cred *cred)
{
xfs_da_args_t args;
int error;
int namelen;
xfs_inode_t *ip = XFS_BHVTOI(bdp);
if (!name)
return EINVAL;
ASSERT(MAXNAMELEN-1 <= 0xff); /* length is stored in uint8 */
namelen = strlen(name);
if (namelen >= MAXNAMELEN)
return EFAULT; /* match IRIX behaviour */
return(EFAULT); /* match IRIX behaviour */
XFS_STATS_INC(xs_attr_get);
if (XFS_IFORK_Q(ip) == 0)
return ENOATTR;
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
return (EIO);
return(EIO);
if ((XFS_IFORK_Q(ip) == 0) ||
(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
ip->i_d.di_anextents == 0))
return(ENOATTR);
if (lock) {
xfs_ilock(ip, XFS_ILOCK_SHARED);
/*
* Do we answer them, or ignore them?
*/
xfs_ilock(ip, XFS_ILOCK_SHARED);
if ((error = xfs_iaccess(XFS_BHVTOI(bdp), IREAD, cred))) {
if ((error = xfs_iaccess(ip, IREAD, cred))) {
xfs_iunlock(ip, XFS_ILOCK_SHARED);
return(XFS_ERROR(error));
}
}
/*
* Fill in the arg structure for this request.
......@@ -177,6 +177,8 @@ xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp,
} else {
error = xfs_attr_node_get(&args);
}
if (lock)
xfs_iunlock(ip, XFS_ILOCK_SHARED);
/*
......@@ -189,6 +191,23 @@ xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp,
return(error);
}
int
xfs_attr_fetch(xfs_inode_t *ip, char *name, char *value, int valuelen)
{
return xfs_attr_get_int(ip, name, value, &valuelen, ATTR_ROOT, 0, NULL);
}
int
xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp,
int flags, struct cred *cred)
{
xfs_inode_t *ip = XFS_BHVTOI(bdp);
if (!name)
return(EINVAL);
return xfs_attr_get_int(ip, name, value, valuelenp, flags, 1, cred);
}
/*ARGSUSED*/
int /* error */
xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags,
......@@ -1718,7 +1737,6 @@ xfs_attr_node_get(xfs_da_args_t *args)
int i;
state = xfs_da_state_alloc();
state->holeok = 1;
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
......
......@@ -1141,12 +1141,10 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
xfs_da_node_entry_t *btree;
xfs_dablk_t blkno;
int probe, span, max, error, retval;
xfs_daddr_t mappedbno;
xfs_dahash_t hashval;
xfs_da_args_t *args;
args = state->args;
mappedbno = state->holeok ? -2 : -1;
/*
* Descend thru the B-tree searching each level for the right
......@@ -1164,9 +1162,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
*/
blk->blkno = blkno;
error = xfs_da_read_buf(args->trans, args->dp, blkno,
mappedbno, &blk->bp, args->whichfork);
if (!error && unlikely(state->holeok && !blk->bp))
error = XFS_ERROR(ENOATTR); /* always attr here */
-1, &blk->bp, args->whichfork);
if (error) {
blk->blkno = 0;
state->path.active--;
......
......@@ -253,7 +253,6 @@ typedef struct xfs_da_state {
xfs_da_state_path_t path; /* search/split paths */
xfs_da_state_path_t altpath; /* alternate path for join */
unsigned char inleaf; /* insert into 1->lf, 0->splf */
unsigned char holeok; /* T/F: can deal with a hole */
unsigned char extravalid; /* T/F: extrablk is in use */
unsigned char extraafter; /* T/F: extrablk is after new */
xfs_da_state_blk_t extrablk; /* for double-splits on leafs */
......
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