{
struct vrequest *treq = NULL;
struct vcache *vcp;
- struct vattr vattr;
+ struct vattr *vattr = NULL;
struct inode *ip;
struct dentry *dp;
afs_int32 code;
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ return ERR_PTR(-afs_CheckCode(code, NULL, xxx));
+ }
+
code = afs_CreateReq(&treq, credp);
if (code) {
#ifdef OSI_EXPORT_DEBUG
afid->Cell, afid->Fid.Volume, afid->Fid.Vnode, afid->Fid.Unique,
code);
#endif
+ afs_DestroyAttr(vattr);
return ERR_PTR(-afs_CheckCode(code, NULL, 101));
}
vcp = afs_GetVCache(afid, treq, NULL, NULL);
afid->Cell, afid->Fid.Volume, afid->Fid.Vnode, afid->Fid.Unique);
#endif
afs_DestroyReq(treq);
+ afs_DestroyAttr(vattr);
return NULL;
}
afs_PutVCache(vcp);
code = afs_CheckCode(code, treq, 103);
afs_DestroyReq(treq);
+ afs_DestroyAttr(vattr);
return ERR_PTR(-code);
}
ip = AFSTOV(vcp);
- afs_getattr(vcp, &vattr, credp);
- afs_fill_inode(ip, &vattr);
+ afs_getattr(vcp, vattr, credp);
+ afs_fill_inode(ip, vattr);
/* d_alloc_anon might block, so we shouldn't hold the glock */
AFS_GUNLOCK();
afid->Cell, afid->Fid.Volume, afid->Fid.Vnode, afid->Fid.Unique);
#endif
afs_DestroyReq(treq);
+ afs_DestroyAttr(vattr);
return ERR_PTR(-ENOMEM);
}
dp->d_op = &afs_dentry_operations;
afs_DestroyReq(treq);
+ afs_DestroyAttr(vattr);
return dp;
}
static int
afs_linux_revalidate(struct dentry *dp)
{
- struct vattr vattr;
+ struct vattr *vattr = NULL;
struct vcache *vcp = VTOAFS(dp->d_inode);
cred_t *credp;
int code;
AFS_GLOCK();
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ goto out;
+ }
+
#ifdef notyet
/* Make this a fast path (no crref), since it's called so often. */
if (vcp->states & CStatd) {
crfree(credp);
}
}
+ afs_DestroyAttr(vattr);
return 0;
}
#endif
(!afs_fakestat_enable || vcp->mvstat != 1) &&
!afs_nfsexporter &&
(vType(vcp) == VDIR || vType(vcp) == VLNK)) {
- code = afs_CopyOutAttrs(vcp, &vattr);
+ code = afs_CopyOutAttrs(vcp, vattr);
} else {
credp = crref();
- code = afs_getattr(vcp, &vattr, credp);
+ code = afs_getattr(vcp, vattr, credp);
crfree(credp);
}
if (!code)
- afs_fill_inode(AFSTOV(vcp), &vattr);
+ afs_fill_inode(AFSTOV(vcp), vattr);
+ afs_DestroyAttr(vattr);
+
+out:
AFS_GUNLOCK();
return afs_convert_code(code);
static int
afs_notify_change(struct dentry *dp, struct iattr *iattrp)
{
- struct vattr vattr;
+ struct vattr *vattr = NULL;
cred_t *credp = crref();
struct inode *ip = dp->d_inode;
int code;
- VATTR_NULL(&vattr);
- iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
-
AFS_GLOCK();
- code = afs_setattr(VTOAFS(ip), &vattr, credp);
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ goto out;
+ }
+
+ iattr2vattr(vattr, iattrp); /* Convert for AFS vnodeops call. */
+
+ code = afs_setattr(VTOAFS(ip), vattr, credp);
if (!code) {
- afs_getattr(VTOAFS(ip), &vattr, credp);
- vattr2inode(ip, &vattr);
+ afs_getattr(VTOAFS(ip), vattr, credp);
+ vattr2inode(ip, vattr);
}
+ afs_DestroyAttr(vattr);
+
+out:
AFS_GUNLOCK();
crfree(credp);
return afs_convert_code(code);
afs_linux_dentry_revalidate(struct dentry *dp, int flags)
#endif
{
- struct vattr vattr;
cred_t *credp = NULL;
struct vcache *vcp, *pvcp, *tvc = NULL;
struct dentry *parent;
}
if (locked && (parent_dv > dp->d_time || !(vcp->f.states & CStatd))) {
+ struct vattr *vattr = NULL;
int code;
code = afs_lookup(pvcp, (char *)dp->d_name.name, &tvc, credp);
goto bad_dentry;
}
- if (afs_getattr(vcp, &vattr, credp)) {
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ dput(parent);
+ goto bad_dentry;
+ }
+
+ if (afs_getattr(vcp, vattr, credp)) {
dput(parent);
+ afs_DestroyAttr(vattr);
goto bad_dentry;
}
- vattr2inode(AFSTOV(vcp), &vattr);
+ vattr2inode(AFSTOV(vcp), vattr);
dp->d_time = parent_dv;
+
+ afs_DestroyAttr(vattr);
}
/* should we always update the attributes at this point? */
afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
#endif
{
- struct vattr vattr;
+ struct vattr *vattr = NULL;
cred_t *credp = crref();
const char *name = dp->d_name.name;
struct vcache *vcp;
int code;
- VATTR_NULL(&vattr);
- vattr.va_mode = mode;
- vattr.va_type = mode & S_IFMT;
-
AFS_GLOCK();
- code = afs_create(VTOAFS(dip), (char *)name, &vattr, NONEXCL, mode,
+
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ goto out;
+ }
+ vattr->va_mode = mode;
+ vattr->va_type = mode & S_IFMT;
+
+ code = afs_create(VTOAFS(dip), (char *)name, vattr, NONEXCL, mode,
&vcp, credp);
if (!code) {
struct inode *ip = AFSTOV(vcp);
- afs_getattr(vcp, &vattr, credp);
- afs_fill_inode(ip, &vattr);
+ afs_getattr(vcp, vattr, credp);
+ afs_fill_inode(ip, vattr);
insert_inode_hash(ip);
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
dp->d_time = parent_vcache_dv(dip, credp);
d_instantiate(dp, ip);
}
+
+ afs_DestroyAttr(vattr);
+
+out:
AFS_GUNLOCK();
crfree(credp);
code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp);
if (vcp) {
- struct vattr vattr;
+ struct vattr *vattr = NULL;
struct vcache *parent_vc = VTOAFS(dip);
if (parent_vc == vcp) {
goto done;
}
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ afs_PutVCache(vcp);
+ AFS_GUNLOCK();
+ goto done;
+ }
+
ip = AFSTOV(vcp);
- afs_getattr(vcp, &vattr, credp);
- afs_fill_inode(ip, &vattr);
+ afs_getattr(vcp, vattr, credp);
+ afs_fill_inode(ip, vattr);
if (hlist_unhashed(&ip->i_hash))
insert_inode_hash(ip);
+
+ afs_DestroyAttr(vattr);
}
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
{
int code;
cred_t *credp = crref();
- struct vattr vattr;
+ struct vattr *vattr = NULL;
const char *name = dp->d_name.name;
/* If afs_symlink returned the vnode, we could instantiate the
*/
d_drop(dp);
- VATTR_NULL(&vattr);
AFS_GLOCK();
- code = afs_symlink(VTOAFS(dip), (char *)name, &vattr, (char *)target, NULL,
- credp);
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ goto out;
+ }
+
+ code = afs_symlink(VTOAFS(dip), (char *)name, vattr, (char *)target, NULL,
+ credp);
+ afs_DestroyAttr(vattr);
+
+out:
AFS_GUNLOCK();
crfree(credp);
return afs_convert_code(code);
int code;
cred_t *credp = crref();
struct vcache *tvcp = NULL;
- struct vattr vattr;
+ struct vattr *vattr = NULL;
const char *name = dp->d_name.name;
- VATTR_NULL(&vattr);
- vattr.va_mask = ATTR_MODE;
- vattr.va_mode = mode;
AFS_GLOCK();
- code = afs_mkdir(VTOAFS(dip), (char *)name, &vattr, &tvcp, credp);
+ code = afs_CreateAttr(&vattr);
+ if (code) {
+ goto out;
+ }
+
+ vattr->va_mask = ATTR_MODE;
+ vattr->va_mode = mode;
+
+ code = afs_mkdir(VTOAFS(dip), (char *)name, vattr, &tvcp, credp);
if (tvcp) {
struct inode *ip = AFSTOV(tvcp);
- afs_getattr(tvcp, &vattr, credp);
- afs_fill_inode(ip, &vattr);
+ afs_getattr(tvcp, vattr, credp);
+ afs_fill_inode(ip, vattr);
#if !defined(STRUCT_SUPER_BLOCK_HAS_S_D_OP)
dp->d_op = &afs_dentry_operations;
dp->d_time = hgetlo(VTOAFS(dip)->f.m.DataVersion);
d_instantiate(dp, ip);
}
+ afs_DestroyAttr(vattr);
+
+out:
AFS_GUNLOCK();
crfree(credp);