mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
Linux: Remove the BKL
Recent investigations suggest that we no long require the BKL on Linux. As an experiment, remove it. Change-Id: I764fe1f6e9761ada5a0a86ba59450c0615bb1e78 Reviewed-on: http://gerrit.openafs.org/1823 Tested-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
77ebaaf639
commit
196d2c7f9e
@ -545,13 +545,11 @@ static struct dentry *afs_export_get_dentry(struct super_block *sb,
|
|||||||
cred_t *credp;
|
cred_t *credp;
|
||||||
|
|
||||||
credp = crref();
|
credp = crref();
|
||||||
lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
|
|
||||||
dp = get_dentry_from_fid(credp, inump);
|
dp = get_dentry_from_fid(credp, inump);
|
||||||
|
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
|
|
||||||
return dp;
|
return dp;
|
||||||
@ -609,7 +607,6 @@ static int afs_export_get_name(struct dentry *parent, char *name,
|
|||||||
afs_InitFakeStat(&fakestate);
|
afs_InitFakeStat(&fakestate);
|
||||||
|
|
||||||
credp = crref();
|
credp = crref();
|
||||||
lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
|
|
||||||
vcp = VTOAFS(child->d_inode);
|
vcp = VTOAFS(child->d_inode);
|
||||||
@ -818,7 +815,6 @@ done:
|
|||||||
}
|
}
|
||||||
afs_PutFakeStat(&fakestate);
|
afs_PutFakeStat(&fakestate);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
code = afs_CheckCode(code, &treq, 102);
|
code = afs_CheckCode(code, &treq, 102);
|
||||||
return -code;
|
return -code;
|
||||||
@ -846,7 +842,6 @@ static struct dentry *afs_export_get_parent(struct dentry *child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
credp = crref();
|
credp = crref();
|
||||||
lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
|
|
||||||
vcp = VTOAFS(child->d_inode);
|
vcp = VTOAFS(child->d_inode);
|
||||||
@ -938,7 +933,6 @@ static struct dentry *afs_export_get_parent(struct dentry *child)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
|
|
||||||
return dp;
|
return dp;
|
||||||
|
@ -204,7 +204,6 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
|||||||
newattrs.ia_ctime = CURRENT_TIME;
|
newattrs.ia_ctime = CURRENT_TIME;
|
||||||
|
|
||||||
/* avoid notify_change() since it wants to update dentry->d_parent */
|
/* avoid notify_change() since it wants to update dentry->d_parent */
|
||||||
lock_kernel();
|
|
||||||
code = inode_change_ok(inode, &newattrs);
|
code = inode_change_ok(inode, &newattrs);
|
||||||
if (!code) {
|
if (!code) {
|
||||||
#ifdef INODE_SETATTR_NOT_VOID
|
#ifdef INODE_SETATTR_NOT_VOID
|
||||||
@ -216,7 +215,6 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
|||||||
inode_setattr(inode, &newattrs);
|
inode_setattr(inode, &newattrs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
unlock_kernel();
|
|
||||||
if (!code)
|
if (!code)
|
||||||
truncate_inode_pages(&inode->i_data, asize);
|
truncate_inode_pages(&inode->i_data, asize);
|
||||||
code = -code;
|
code = -code;
|
||||||
|
@ -272,24 +272,20 @@ afs_xsetgroups(int gidsetsize, gid_t * grouplist)
|
|||||||
afs_uint32 junk;
|
afs_uint32 junk;
|
||||||
int old_pag;
|
int old_pag;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
old_pag = PagInCred(cr);
|
old_pag = PagInCred(cr);
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
code = (*sys_setgroupsp) (gidsetsize, grouplist);
|
code = (*sys_setgroupsp) (gidsetsize, grouplist);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
cr = crref();
|
cr = crref();
|
||||||
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
||||||
/* re-install old pag if there's room. */
|
/* re-install old pag if there's room. */
|
||||||
code = __setpag(&cr, old_pag, &junk, 0);
|
code = __setpag(&cr, old_pag, &junk, 0);
|
||||||
}
|
}
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
/* Linux syscall ABI returns errno as negative */
|
/* Linux syscall ABI returns errno as negative */
|
||||||
return (-code);
|
return (-code);
|
||||||
@ -305,10 +301,8 @@ afs_xsetgroups32(int gidsetsize, gid_t * grouplist)
|
|||||||
afs_uint32 junk;
|
afs_uint32 junk;
|
||||||
int old_pag;
|
int old_pag;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
old_pag = PagInCred(cr);
|
old_pag = PagInCred(cr);
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
code = (*sys_setgroups32p) (gidsetsize, grouplist);
|
code = (*sys_setgroups32p) (gidsetsize, grouplist);
|
||||||
|
|
||||||
@ -316,14 +310,12 @@ afs_xsetgroups32(int gidsetsize, gid_t * grouplist)
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
cr = crref();
|
cr = crref();
|
||||||
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
||||||
/* re-install old pag if there's room. */
|
/* re-install old pag if there's room. */
|
||||||
code = __setpag(&cr, old_pag, &junk, 0);
|
code = __setpag(&cr, old_pag, &junk, 0);
|
||||||
}
|
}
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
/* Linux syscall ABI returns errno as negative */
|
/* Linux syscall ABI returns errno as negative */
|
||||||
return (-code);
|
return (-code);
|
||||||
@ -339,24 +331,20 @@ asmlinkage long afs32_xsetgroups(int gidsetsize, gid_t *grouplist)
|
|||||||
afs_uint32 junk;
|
afs_uint32 junk;
|
||||||
int old_pag;
|
int old_pag;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
old_pag = PagInCred(cr);
|
old_pag = PagInCred(cr);
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
code = (*sys32_setgroupsp)(gidsetsize, grouplist);
|
code = (*sys32_setgroupsp)(gidsetsize, grouplist);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
cr = crref();
|
cr = crref();
|
||||||
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
||||||
/* re-install old pag if there's room. */
|
/* re-install old pag if there's room. */
|
||||||
code = __setpag(&cr, old_pag, &junk, 0);
|
code = __setpag(&cr, old_pag, &junk, 0);
|
||||||
}
|
}
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
/* Linux syscall ABI returns errno as negative */
|
/* Linux syscall ABI returns errno as negative */
|
||||||
return (-code);
|
return (-code);
|
||||||
@ -374,24 +362,20 @@ afs32_xsetgroups(int gidsetsize, u16 * grouplist)
|
|||||||
afs_uint32 junk;
|
afs_uint32 junk;
|
||||||
int old_pag;
|
int old_pag;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
old_pag = PagInCred(cr);
|
old_pag = PagInCred(cr);
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
code = (*sys32_setgroupsp) (gidsetsize, grouplist);
|
code = (*sys32_setgroupsp) (gidsetsize, grouplist);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
cr = crref();
|
cr = crref();
|
||||||
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
||||||
/* re-install old pag if there's room. */
|
/* re-install old pag if there's room. */
|
||||||
code = __setpag(&cr, old_pag, &junk, 0);
|
code = __setpag(&cr, old_pag, &junk, 0);
|
||||||
}
|
}
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
/* Linux syscall ABI returns errno as negative */
|
/* Linux syscall ABI returns errno as negative */
|
||||||
return (-code);
|
return (-code);
|
||||||
@ -407,24 +391,20 @@ afs32_xsetgroups32(int gidsetsize, gid_t * grouplist)
|
|||||||
afs_uint32 junk;
|
afs_uint32 junk;
|
||||||
int old_pag;
|
int old_pag;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
old_pag = PagInCred(cr);
|
old_pag = PagInCred(cr);
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
code = (*sys32_setgroups32p) (gidsetsize, grouplist);
|
code = (*sys32_setgroups32p) (gidsetsize, grouplist);
|
||||||
if (code) {
|
if (code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
cr = crref();
|
cr = crref();
|
||||||
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
|
||||||
/* re-install old pag if there's room. */
|
/* re-install old pag if there's room. */
|
||||||
code = __setpag(&cr, old_pag, &junk, 0);
|
code = __setpag(&cr, old_pag, &junk, 0);
|
||||||
}
|
}
|
||||||
crfree(cr);
|
crfree(cr);
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
/* Linux syscall ABI returns errno as negative */
|
/* Linux syscall ABI returns errno as negative */
|
||||||
return (-code);
|
return (-code);
|
||||||
|
@ -208,7 +208,6 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp)
|
|||||||
VATTR_NULL(&vattr);
|
VATTR_NULL(&vattr);
|
||||||
iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
|
iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_setattr(VTOAFS(ip), &vattr, credp);
|
code = afs_setattr(VTOAFS(ip), &vattr, credp);
|
||||||
if (!code) {
|
if (!code) {
|
||||||
@ -216,7 +215,6 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp)
|
|||||||
vattr2inode(ip, &vattr);
|
vattr2inode(ip, &vattr);
|
||||||
}
|
}
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return -code;
|
return -code;
|
||||||
}
|
}
|
||||||
|
@ -53,21 +53,6 @@ extern struct backing_dev_info *afs_backing_dev_info;
|
|||||||
|
|
||||||
extern struct vcache *afs_globalVp;
|
extern struct vcache *afs_globalVp;
|
||||||
extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp);
|
extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp);
|
||||||
/* Some uses of BKL are perhaps not needed for bypass or memcache--
|
|
||||||
* why don't we try it out? */
|
|
||||||
extern struct afs_cacheOps afs_UfsCacheOps;
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
afs_maybe_lock_kernel(void) {
|
|
||||||
if(afs_cacheType == &afs_UfsCacheOps)
|
|
||||||
lock_kernel();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
afs_maybe_unlock_kernel(void) {
|
|
||||||
if(afs_cacheType == &afs_UfsCacheOps)
|
|
||||||
unlock_kernel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function converts a positive error code from AFS into a negative
|
/* This function converts a positive error code from AFS into a negative
|
||||||
* code suitable for passing into the Linux VFS layer. It checks that the
|
* code suitable for passing into the Linux VFS layer. It checks that the
|
||||||
@ -212,7 +197,6 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
|
|||||||
cred_t *credp = crref();
|
cred_t *credp = crref();
|
||||||
struct afs_fakestat_state fakestat;
|
struct afs_fakestat_state fakestat;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
AFS_STATCNT(afs_readdir);
|
AFS_STATCNT(afs_readdir);
|
||||||
|
|
||||||
@ -364,7 +348,6 @@ out:
|
|||||||
afs_PutFakeStat(&fakestat);
|
afs_PutFakeStat(&fakestat);
|
||||||
out1:
|
out1:
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,11 +399,9 @@ afs_linux_open(struct inode *ip, struct file *fp)
|
|||||||
cred_t *credp = crref();
|
cred_t *credp = crref();
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_open(&vcp, fp->f_flags, credp);
|
code = afs_open(&vcp, fp->f_flags, credp);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
@ -433,7 +414,6 @@ afs_linux_release(struct inode *ip, struct file *fp)
|
|||||||
cred_t *credp = crref();
|
cred_t *credp = crref();
|
||||||
int code = 0;
|
int code = 0;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_close(vcp, fp->f_flags, credp);
|
code = afs_close(vcp, fp->f_flags, credp);
|
||||||
ObtainWriteLock(&vcp->lock, 807);
|
ObtainWriteLock(&vcp->lock, 807);
|
||||||
@ -443,7 +423,6 @@ afs_linux_release(struct inode *ip, struct file *fp)
|
|||||||
}
|
}
|
||||||
ReleaseWriteLock(&vcp->lock);
|
ReleaseWriteLock(&vcp->lock);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
@ -460,11 +439,9 @@ afs_linux_fsync(struct file *fp, int datasync)
|
|||||||
struct inode *ip = FILE_INODE(fp);
|
struct inode *ip = FILE_INODE(fp);
|
||||||
cred_t *credp = crref();
|
cred_t *credp = crref();
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_fsync(VTOAFS(ip), credp);
|
code = afs_fsync(VTOAFS(ip), credp);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
|
|
||||||
@ -781,7 +758,6 @@ afs_linux_revalidate(struct dentry *dp)
|
|||||||
if (afs_shuttingdown)
|
if (afs_shuttingdown)
|
||||||
return EIO;
|
return EIO;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
@ -792,7 +768,6 @@ afs_linux_revalidate(struct dentry *dp)
|
|||||||
check_bad_parent(dp); /* check and correct mvid */
|
check_bad_parent(dp); /* check and correct mvid */
|
||||||
|
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
unlock_kernel();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -814,7 +789,6 @@ afs_linux_revalidate(struct dentry *dp)
|
|||||||
afs_fill_inode(AFSTOV(vcp), &vattr);
|
afs_fill_inode(AFSTOV(vcp), &vattr);
|
||||||
|
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
}
|
}
|
||||||
@ -850,7 +824,6 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
|
|||||||
int valid;
|
int valid;
|
||||||
struct afs_fakestat_state fakestate;
|
struct afs_fakestat_state fakestate;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
afs_InitFakeStat(&fakestate);
|
afs_InitFakeStat(&fakestate);
|
||||||
|
|
||||||
@ -963,7 +936,6 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
|
|||||||
shrink_dcache_parent(dp);
|
shrink_dcache_parent(dp);
|
||||||
d_drop(dp);
|
d_drop(dp);
|
||||||
}
|
}
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
return valid;
|
return valid;
|
||||||
|
|
||||||
bad_dentry:
|
bad_dentry:
|
||||||
@ -1034,7 +1006,6 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
|
|||||||
vattr.va_mode = mode;
|
vattr.va_mode = mode;
|
||||||
vattr.va_type = mode & S_IFMT;
|
vattr.va_type = mode & S_IFMT;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_create(VTOAFS(dip), (char *)name, &vattr, NONEXCL, mode,
|
code = afs_create(VTOAFS(dip), (char *)name, &vattr, NONEXCL, mode,
|
||||||
&vcp, credp);
|
&vcp, credp);
|
||||||
@ -1051,7 +1022,6 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
|
|||||||
}
|
}
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
|
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
}
|
}
|
||||||
@ -1072,7 +1042,6 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
|
|||||||
struct dentry *newdp = NULL;
|
struct dentry *newdp = NULL;
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp);
|
code = afs_lookup(VTOAFS(dip), (char *)comp, &vcp, credp);
|
||||||
|
|
||||||
@ -1100,7 +1069,6 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
|
|||||||
dput(alias);
|
dput(alias);
|
||||||
} else {
|
} else {
|
||||||
iput(ip);
|
iput(ip);
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
@ -1108,7 +1076,6 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
|
|||||||
}
|
}
|
||||||
newdp = d_splice_alias(ip, dp);
|
newdp = d_splice_alias(ip, dp);
|
||||||
|
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
|
|
||||||
/* It's ok for the file to not be found. That's noted by the caller by
|
/* It's ok for the file to not be found. That's noted by the caller by
|
||||||
@ -1212,8 +1179,6 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp)
|
|||||||
const char *name = dp->d_name.name;
|
const char *name = dp->d_name.name;
|
||||||
struct vcache *tvc = VTOAFS(dp->d_inode);
|
struct vcache *tvc = VTOAFS(dp->d_inode);
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
|
|
||||||
if (VREFCOUNT(tvc) > 1 && tvc->opens > 0
|
if (VREFCOUNT(tvc) > 1 && tvc->opens > 0
|
||||||
&& !(tvc->f.states & CUnlinked)) {
|
&& !(tvc->f.states & CUnlinked)) {
|
||||||
|
|
||||||
@ -1226,7 +1191,6 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp)
|
|||||||
d_drop(dp);
|
d_drop(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
}
|
}
|
||||||
@ -1262,7 +1226,6 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
|
|||||||
struct vattr vattr;
|
struct vattr vattr;
|
||||||
const char *name = dp->d_name.name;
|
const char *name = dp->d_name.name;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
VATTR_NULL(&vattr);
|
VATTR_NULL(&vattr);
|
||||||
vattr.va_mask = ATTR_MODE;
|
vattr.va_mask = ATTR_MODE;
|
||||||
vattr.va_mode = mode;
|
vattr.va_mode = mode;
|
||||||
@ -1281,7 +1244,6 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
|
|||||||
}
|
}
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
|
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
}
|
}
|
||||||
@ -1327,7 +1289,6 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
|
|||||||
struct dentry *rehash = NULL;
|
struct dentry *rehash = NULL;
|
||||||
|
|
||||||
/* Prevent any new references during rename operation. */
|
/* Prevent any new references during rename operation. */
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
|
|
||||||
if (!d_unhashed(newdp)) {
|
if (!d_unhashed(newdp)) {
|
||||||
d_drop(newdp);
|
d_drop(newdp);
|
||||||
@ -1347,8 +1308,6 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
|
|||||||
if (rehash)
|
if (rehash)
|
||||||
d_rehash(rehash);
|
d_rehash(rehash);
|
||||||
|
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
}
|
}
|
||||||
@ -1664,7 +1623,6 @@ afs_linux_fillpage(struct file *fp, struct page *pp)
|
|||||||
setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ,
|
setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ,
|
||||||
AFS_UIOSYS);
|
AFS_UIOSYS);
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
AFS_DISCON_LOCK();
|
AFS_DISCON_LOCK();
|
||||||
afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip,
|
afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip,
|
||||||
@ -1678,7 +1636,6 @@ afs_linux_fillpage(struct file *fp, struct page *pp)
|
|||||||
code);
|
code);
|
||||||
AFS_DISCON_UNLOCK();
|
AFS_DISCON_UNLOCK();
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
if (!code) {
|
if (!code) {
|
||||||
/* XXX valid for no-cache also? Check last bits of files... :)
|
/* XXX valid for no-cache also? Check last bits of files... :)
|
||||||
* Cognate code goes in afs_NoCacheFetchProc. */
|
* Cognate code goes in afs_NoCacheFetchProc. */
|
||||||
@ -1871,9 +1828,7 @@ afs_linux_bypass_readpage(struct file *fp, struct page *pp)
|
|||||||
ancr->length = PAGE_SIZE;
|
ancr->length = PAGE_SIZE;
|
||||||
|
|
||||||
credp = crref();
|
credp = crref();
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
code = afs_ReadNoCache(VTOAFS(FILE_INODE(fp)), ancr, credp);
|
code = afs_ReadNoCache(VTOAFS(FILE_INODE(fp)), ancr, credp);
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
|
|
||||||
return afs_convert_code(code);
|
return afs_convert_code(code);
|
||||||
@ -2085,7 +2040,6 @@ afs_linux_page_writeback(struct inode *ip, struct page *pp,
|
|||||||
buffer = kmap(pp) + offset;
|
buffer = kmap(pp) + offset;
|
||||||
base = page_offset(pp) + offset;
|
base = page_offset(pp) + offset;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
|
afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
|
||||||
ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
|
ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
|
||||||
@ -2105,7 +2059,6 @@ afs_linux_page_writeback(struct inode *ip, struct page *pp,
|
|||||||
ICL_TYPE_INT32, code);
|
ICL_TYPE_INT32, code);
|
||||||
|
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
kunmap(pp);
|
kunmap(pp);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
@ -2135,7 +2088,6 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp,
|
|||||||
credp = crref();
|
credp = crref();
|
||||||
code = afs_linux_page_writeback(ip, pp, offset, count, credp);
|
code = afs_linux_page_writeback(ip, pp, offset, count, credp);
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
ObtainWriteLock(&vcp->lock, 533);
|
ObtainWriteLock(&vcp->lock, 533);
|
||||||
if (code > 0)
|
if (code > 0)
|
||||||
@ -2143,7 +2095,6 @@ afs_linux_writepage_sync(struct inode *ip, struct page *pp,
|
|||||||
afs_linux_complete_writeback(vcp);
|
afs_linux_complete_writeback(vcp);
|
||||||
ReleaseWriteLock(&vcp->lock);
|
ReleaseWriteLock(&vcp->lock);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
|
|
||||||
if (code1)
|
if (code1)
|
||||||
@ -2224,7 +2175,6 @@ afs_linux_writepage(struct page *pp)
|
|||||||
|
|
||||||
code = afs_linux_page_writeback(inode, pp, 0, to, credp);
|
code = afs_linux_page_writeback(inode, pp, 0, to, credp);
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
ObtainWriteLock(&vcp->lock, 538);
|
ObtainWriteLock(&vcp->lock, 538);
|
||||||
|
|
||||||
@ -2240,7 +2190,6 @@ afs_linux_writepage(struct page *pp)
|
|||||||
ReleaseWriteLock(&vcp->lock);
|
ReleaseWriteLock(&vcp->lock);
|
||||||
crfree(credp);
|
crfree(credp);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
end_page_writeback(pp);
|
end_page_writeback(pp);
|
||||||
@ -2427,7 +2376,6 @@ afs_symlink_filler(struct file *file, struct page *page)
|
|||||||
char *p = (char *)kmap(page);
|
char *p = (char *)kmap(page);
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
afs_maybe_lock_kernel();
|
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS);
|
code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
@ -2435,7 +2383,6 @@ afs_symlink_filler(struct file *file, struct page *page)
|
|||||||
if (code < 0)
|
if (code < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
p[code] = '\0'; /* null terminate? */
|
p[code] = '\0'; /* null terminate? */
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
SetPageUptodate(page);
|
SetPageUptodate(page);
|
||||||
kunmap(page);
|
kunmap(page);
|
||||||
@ -2443,8 +2390,6 @@ afs_symlink_filler(struct file *file, struct page *page)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
afs_maybe_unlock_kernel();
|
|
||||||
|
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
kunmap(page);
|
kunmap(page);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
|
@ -595,7 +595,6 @@ Afs_syscall()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef AFS_LINUX20_ENV
|
#ifdef AFS_LINUX20_ENV
|
||||||
lock_kernel();
|
|
||||||
/* setup uap for use below - pull out the magic decoder ring to know
|
/* setup uap for use below - pull out the magic decoder ring to know
|
||||||
* which syscalls have folded argument lists.
|
* which syscalls have folded argument lists.
|
||||||
*/
|
*/
|
||||||
@ -898,7 +897,6 @@ Afs_syscall()
|
|||||||
#endif
|
#endif
|
||||||
#ifdef AFS_LINUX20_ENV
|
#ifdef AFS_LINUX20_ENV
|
||||||
code = -code;
|
code = -code;
|
||||||
unlock_kernel();
|
|
||||||
#endif
|
#endif
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user