commit de69cb633c84100558bbbca5bd49017a4f56ac76
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date: Fri May 25 12:41:48 2007 -0400
removed odf locks, added LOCK comments where we might still want to
lock something, ie when operating in odf/ic /sr and /reclaim
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index b8cf4bf..040e4e4 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -308,7 +308,6 @@ int odf_cache_dir(struct dentry *d_upper, struct dentry
*d_odf, struct timespec
goto out_sb;
retry:
- odf_lock(UNIONFS_SB(sb)->odf->odi_ic);
BUG_ON(!S_ISDIR(d_upper->d_inode->i_mode));
i_odf = d_odf->d_inode;
@@ -360,7 +359,7 @@ retry:
}
/* lock to prevent concurrent writes */
- odf_lock(UNIONFS_D(d_upper)->odf_info);
+ /* LOCK: need to lock ic? */
/* Process the hidden directories with rdutil_callback as a filldir. */
for (bindex = bstart; bindex <= bend; bindex++) {
hidden_dentry = unionfs_lower_dentry_idx(d_upper, bindex);
@@ -380,7 +379,7 @@ retry:
err = PTR_ERR(hidden_file);
dput(hidden_dentry);
branchput(sb, bindex);
- goto out_unlock;
+ goto out;
}
do {
@@ -399,9 +398,8 @@ retry:
branchput(sb, bindex);
if (err < 0)
- goto out_unlock;
+ goto out;
}
- odf_unlock(UNIONFS_D(d_upper)->odf_info);
/* set mtime of odf file to that of higher file */
attr.ia_mtime = *mtime;
@@ -409,9 +407,6 @@ retry:
err = notify_change(d_odf, &attr);
goto out;
-out_unlock:
- odf_unlock(UNIONFS_D(d_upper)->odf_info);
-
out:
if (buf && buf->rdstate)
free_rdstate(buf->rdstate);
@@ -422,8 +417,6 @@ out:
filp_close(odf_file, NULL);
odf_file = NULL;
- odf_unlock(UNIONFS_SB(sb)->odf->odi_ic);
-
if (err == -ENOSPC && !cleaned) {
cleaned = 1;
wake_up_and_wait_sioa(UNIONFS_SB(sb)->odf->cleanup);
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 7a45279..617e3dd 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -333,8 +333,6 @@ int odf_reclaim(struct dentry *dentry, int sr)
goto out;
}
sprintf(new_name, "%lu", odf_dentry->d_inode->i_ino);
- /* lock new dir, the old dir should already be locked */
- odf_lock(odi);
old_dentry = odf_dentry;
old_dir = odf_dentry->d_parent->d_inode;
@@ -342,7 +340,7 @@ int odf_reclaim(struct dentry *dentry, int sr)
new_dentry = lookup_one_len(new_name, odi->dentry, strlen(new_name));
if (IS_ERR(new_dentry)) {
err = PTR_ERR(new_dentry);
- goto out_unlock;
+ goto out;
}
lock_rename(old_dentry->d_parent, new_dentry->d_parent);
@@ -350,9 +348,6 @@ int odf_reclaim(struct dentry *dentry, int sr)
unlock_rename(old_dentry->d_parent, new_dentry->d_parent);
dput(new_dentry);
-out_unlock:
- odf_unlock(odi); /* unlock new dir */
-
out:
kfree(new_name);
return err;
@@ -379,8 +374,7 @@ int odf_release_sr(struct inode *inode)
}
sprintf(name, "%lu", inode->i_ino);
- odf_lock(odi_sr);
- odf_lock(odi_rc);
+ /* LOCK: need to lock sr? */
/* check for an entry in /odf/sr */
old_dentry = lookup_one_len(name, odi_sr->dentry, strlen(name));
@@ -410,8 +404,6 @@ int odf_release_sr(struct inode *inode)
unlock_rename(old_dentry->d_parent, new_dentry->d_parent);
out_unlock:
- odf_unlock(odi_rc);
- odf_unlock(odi_sr);
dput(old_dentry);
dput(new_dentry);
out:
@@ -449,9 +441,6 @@ int odf_rename(struct dentry *old_dentry, struct dentry
*new_dentry)
if (UNIONFS_D(new_dentry)->odf_info)
err = odf_remove(new_dentry, ODF_RMV_ANY);
- odf_lock(UNIONFS_D(old_dentry)->odf_info);
- odf_lock(UNIONFS_D(new_dentry->d_parent)->odf_info);
-
old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
old_dir = old_odfdentry->d_parent;
new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
@@ -479,8 +468,6 @@ int odf_rename(struct dentry *old_dentry, struct dentry
*new_dentry)
dput(new_odfdentry);
out_unlock:
- odf_unlock(UNIONFS_D(old_dentry)->odf_info);
- odf_unlock(UNIONFS_D(new_dentry->d_parent)->odf_info);
err = odf_lookup(old_dentry->d_parent, old_dentry, 0);
out:
return err;
@@ -507,8 +494,6 @@ int odf_link(struct dentry *old_dentry, struct dentry
*new_dentry)
if (UNIONFS_D(new_dentry)->odf_info)
err = odf_remove(new_dentry, ODF_RMV_ANY);
- odf_lock(UNIONFS_D(old_dentry)->odf_info);
- odf_lock(UNIONFS_D(new_dentry->d_parent)->odf_info);
old_odfdentry = UNIONFS_D(old_dentry)->odf_info->dentry;
old_dir = old_odfdentry->d_parent;
new_dir = (UNIONFS_D(new_dentry->d_parent))->odf_info->dentry;
@@ -518,7 +503,7 @@ int odf_link(struct dentry *old_dentry, struct dentry
*new_dentry)
new_dentry->d_name.len);
if (IS_ERR(new_odfdentry)) {
err = PTR_ERR(new_odfdentry);
- goto out_unlock;
+ goto out;
}
/* this should never happen */
@@ -531,9 +516,6 @@ int odf_link(struct dentry *old_dentry, struct dentry
*new_dentry)
current->fsgid = oldgid;
dput(new_odfdentry);
-out_unlock:
- odf_unlock(UNIONFS_D(old_dentry)->odf_info);
- odf_unlock(UNIONFS_D(new_dentry->d_parent)->odf_info);
out:
return err;
}
@@ -808,8 +790,6 @@ skip:
if (branch_dst >= 0)
dst_ro = is_robranch_super(dentry->d_sb, branch_dst);
- odf_lock(UNIONFS_D(dentry->d_parent)->odf_info);
-
/* case 0:
* - dest branch id has changed because of remounts
* - do not copyup, remove copyup info from link info file
@@ -825,7 +805,7 @@ skip:
if (err != sizeof(__le32)){
set_fs(oldfs);
err = -EIO;
- goto out_unlock;
+ goto out;
}
le64 = 0;
@@ -834,7 +814,7 @@ skip:
if (err != sizeof(__le64)){
set_fs(oldfs);
err = -EIO;
- goto out_unlock;
+ goto out;
}
set_fs(oldfs);
@@ -860,7 +840,7 @@ skip:
if (!lower_dentry || IS_ERR(lower_dentry)) {
if (IS_ERR(lower_dentry))
err = PTR_ERR(lower_dentry);
- goto out_unlock;
+ goto out;
}
/* now link */
}
@@ -891,10 +871,6 @@ skip:
;
}
-
-out_unlock:
- odf_unlock(UNIONFS_D(dentry->d_parent)->odf_info);
- goto out;
out_fs:
set_fs(oldfs);
out:
@@ -1050,14 +1026,6 @@ struct odf_dentry_info *__odf_lookup(struct odf_sb_info
*osi,
BUG_ON(len==1 || (name[1]=='.'&&len==2));
retry:
/* FIXME need to check hardlinks before create */
- if (!(flags & ODF_LOOKUP_LOCKED)){
- if (osi->odi_ic != parent)
- odf_lock(osi->odi_ic);
- odf_lock(parent); /* lock parent */
- }
- else if (cleaned)
- odf_lock(osi->odi_ic);
-
if (link && (flags & (ODF_LOOKUP_FILE | ODF_LOOKUP_LINK))) {
/* link to the given dentry */
vfs_link(link, odf_dentry->d_parent->d_inode,
odf_dentry);
@@ -1079,22 +1047,10 @@ retry:
}
else {
dput(odf_dentry);
- if (!(flags & ODF_LOOKUP_LOCKED)){
- odf_unlock(parent);
- if (osi->odi_ic != parent)
- odf_unlock(osi->odi_ic);
- }
odf_put_info(old_odi);
odi = NULL;
goto out;
}
- if (!(flags & ODF_LOOKUP_LOCKED)){
- odf_unlock(parent);
- if (osi->odi_ic != parent)
- odf_unlock(osi->odi_ic);
- }
- else if (cleaned)
- odf_unlock(osi->odi_ic);
current->fsuid = olduid;
current->fsgid = oldgid;
@@ -1102,8 +1058,6 @@ retry:
if (err) {
if (err == -ENOSPC && !cleaned) {
/* let the cleanup thread do its work and retry
once */
- if (flags & ODF_LOOKUP_LOCKED)
- odf_unlock(osi->odi_ic);
cleaned = 1;
wake_up_and_wait_sioa(osi->cleanup);
goto retry;
@@ -1439,7 +1393,6 @@ int odf_remove(struct dentry *dentry, int flags)
goto out;
odf_dir = UNIONFS_D(dentry->d_parent)->odf_info;
- odf_lock(odf_dir);
/* remove */
current->fsuid = 0;
@@ -1458,13 +1411,11 @@ int odf_remove(struct dentry *dentry, int flags)
current->fsuid = olduid;
current->fsgid = oldgid;
if (err)
- goto out_unlock;
+ goto out;
/* clean up */
odf_put_info(odi);
UNIONFS_D(dentry)->odf_info = NULL;
-out_unlock:
- odf_unlock(odf_dir);
out:
return err;
}
@@ -1902,7 +1853,6 @@ struct odf_dentry_info *odf_alloc_info(struct odf_sb_info
*osi, struct dentry *o
odi->inum = odf_dentry->d_inode->i_ino;
odi->osi = osi;
dget(odf_dentry);
- mutex_init(&odi->lock);
return odi;
}
struct odf_dentry_info *odf_fill_info(struct odf_dentry_info *odi, struct
odf_sb_info *osi, struct dentry *odf_dentry)
@@ -1946,8 +1896,7 @@ void __odf_cleanup(void *args)
/* update timeout */
sioa_args->timeout = msecs_to_jiffies(cl->attr->timeout->val * 1000);
- odf_lock(cl->odf->odi_ic);
- odf_lock(cl->odf->odi_rc);
+ /* LOCK: need to lock ic/reclaim/sr? */
vfs_statfs(cl->odf->sb, &stat);
if (cl->force) {
@@ -1977,6 +1926,4 @@ void __odf_cleanup(void *args)
}
cl->success = err;
}
- odf_unlock(cl->odf->odi_ic);
- odf_unlock(cl->odf->odi_rc);
}
diff --git a/fs/unionfs/odf.h b/fs/unionfs/odf.h
index 0301ba4..ece557e 100644
--- a/fs/unionfs/odf.h
+++ b/fs/unionfs/odf.h
@@ -108,17 +108,6 @@ int __odf_set_opaque(struct dentry *d, int branch);
extern void __odf_cleanup(void *args);
int odf_cleanup(struct odf_sb_info *odf, int mode, u64 size);
-/* Macros for locking an odf dentry info. */
-static inline void odf_lock(struct odf_dentry_info *odi)
-{
- mutex_lock(&odi->lock);
-}
-
-static inline void odf_unlock(struct odf_dentry_info *odi)
-{
- mutex_unlock(&odi->lock);
-}
-
extern void generate_random_uuid(unsigned char uuid_out[16]);
#endif /* _ODF_H_ */
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 0c7ebc7..47b90a8 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -95,7 +95,6 @@ struct odf_dentry_info {
* the data in the odf file. Right now i keep a dentry for easy
* lookup in the underlying ext2
*/
- struct mutex lock;
u64 inum;
int whiteout;
int opaque;
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs