[SSI] openssi/kernel/cluster/ssi/cfs cfs_chard.c, 1.15, 1.16 cfs_mnthooks.c, 1.23, 1.24 cfs_server.c, 1.15, 1.16 cfs_subr.c, 1.25, 1.26 cfsproc.c, 1.32, 1.33 cfstok.c, 1.20, 1.21 dir.c, 1.25, 1.26 file.c, 1.22, 1.23 inode.c, 1.59, 1.60 pagelist.c, 1.12, 1.13 proc.c, 1.19, 1.20 svrcfs.c, 1.23, 1.24 vfs.c, 1.30, 1.31 write.c, 1.36, 1.37
Roger Tsang <[email protected]>
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29491/cluster/ssi/cfs
Modified Files:
Tag: OPENSSI-FC
cfs_chard.c cfs_mnthooks.c cfs_server.c cfs_subr.c cfsproc.c
cfstok.c dir.c file.c inode.c pagelist.c proc.c svrcfs.c vfs.c
write.c
Log Message:
Bug fixes and enhancements (see ChangeLog)
Index: cfs_server.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfs_server.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cfs_server.c 3 Feb 2009 06:18:12 -0000 1.15
+++ cfs_server.c 24 Mar 2009 04:26:28 -0000 1.16
@@ -453,7 +453,9 @@
nsc_nlcookie_t nl_cookie; /* Magic cookie for nodelist. */
clusternode_t node; /* Current node. */
struct inode *rootip; /* Pointer to root inode. */
+#ifdef SSI_SKIP
struct svrcfstok *roothp; /* Pointer to root token structure. */
+#endif
SSI_ASSERT(sb != NULL);
@@ -473,20 +475,14 @@
else {
nlp = NSC_NODELIST_ALLOC();
if (nlp != NULL) {
- if ((rootip = sb->s_root->d_inode)) {
- igrab(rootip);
- roothp = itoc(rootip)->c_hp;
- if (roothp) {
- HASH_HOLD(roothp);
- *nlp = svrcfstok_get_mholdlist(roothp);
- HASH_RELE(roothp);
- } else
+ if ((rootip = sb->s_root->d_inode) && igrab(rootip)) {
+ if (itoc(rootip)->c_hp) {
+ *nlp = svrcfstok_get_mholdlist(itoc(rootip)->c_hp);
+ } else /* SSI_XXX: BUG? */
error = -EBUSY;
iput(rootip);
- } else {
- roothp = NULL;
+ } else
error = -EBUSY;
- }
#ifdef SSI_SKIP
/* Do not remove. Keep for reference */
/* SSI_XXX: Is this safe without locking? */
@@ -822,8 +818,10 @@
continue;
}
+ down(&dir->i_sem);
pdp = lookup_one_len(dp->d_name, ddir, strlen(dp->d_name));
if (IS_ERR(pdp)) {
+ up(&dir->i_sem);
error = PTR_ERR((void *)pdp);
break;
}
@@ -850,6 +848,7 @@
}
if (thp) {
+ up(&dir->i_sem);
#ifndef SVRCFSTOK_SCT_FLAGS_NOLOCK
LOCK_COND_LOCK(&thp->sct_statelock);
@@ -869,15 +868,16 @@
HASH_RELE(thp);
} else if (S_ISDIR(pdp->d_inode->i_mode)) {
- error = vfs_rmdir(ddir->d_inode, pdp);
-
+ error = vfs_rmdir(dir, pdp);
+ up(&dir->i_sem);
if (error) {
printk(KERN_WARNING
"cfs_rb_delayedunlinks: rmdir %s "
"returned %d \n", dp->d_name,error);
}
} else {
- error = vfs_unlink(ddir->d_inode, pdp);
+ error = vfs_unlink(dir, pdp);
+ up(&dir->i_sem);
if (error) {
printk(KERN_WARNING
"cfs_rb_delayedunlinks: remove %s "
Index: cfs_chard.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfs_chard.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cfs_chard.c 10 Oct 2008 08:10:31 -0000 1.15
+++ cfs_chard.c 24 Mar 2009 04:26:28 -0000 1.16
@@ -605,7 +605,7 @@
* know if this applies to Linux.
*/
if (!error) {
- shrink_dcache_parent(sb->s_root);
+ /* shrink_dcache_parent(sb->s_root); */
cfs_rebuild_tokens(sb, TRUE);
}
/* Send completion message. */
Index: inode.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/inode.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- inode.c 22 Feb 2009 04:15:37 -0000 1.59
+++ inode.c 24 Mar 2009 04:26:28 -0000 1.60
@@ -180,11 +180,6 @@
};
#endif /* SSI_CFS_FROMNFS */
-struct cfs_find_desc {
- struct cfsdirok *cdrok;
- svrcfstok_t *hp;
-};
-
void
cfs_cdrok_inst_token (struct inode *newip, struct cfsdirok *resp)
{
@@ -236,10 +231,11 @@
{
dprintk ("CFS: delete_inode(%x/%ld)\n", inode->i_sb->s_dev, inode->i_ino);
-#ifdef XXX_DONE_IN_BASE
/* SSI_XXX: Where did this come from? */
+ /* It's needed on 2.6.14 or we get an panic in clear_inode
+ * (nr_pages != 0) when renaming - JH
+ */
truncate_inode_pages(&inode->i_data, 0);
-#endif
cfs_wb_all(inode);
/*
@@ -263,6 +259,7 @@
{
int error;
struct cnode *cp;
+ struct svrcfstok *hp;
cfs_wb_all(inode);
#ifdef SSI_CFS_EXNFS
@@ -299,9 +296,13 @@
SSI_ASSERT(!error);
cp = itoc(inode);
- if (cp->c_hp)
- HASH_RELE(cp->c_hp);
+ LOCK_COND_LOCK(&cp->c_statelock);
+ hp = cp->c_hp;
+ mb();
cp->c_hp = NULL;
+ UNLOCK_COND_LOCK(&cp->c_statelock);
+ if (hp)
+ HASH_RELE(hp);
}
void
@@ -497,10 +498,14 @@
static void
cfs_invalidate_inode(struct inode *inode)
{
+#ifdef CFS_FLAGS_BITOPS
+ set_bit(CFS_INO_STALE, &CFS_FLAGS(inode));
+#else
umode_t save_mode = inode->i_mode;
make_bad_inode(inode);
inode->i_mode = save_mode;
+#endif
cfs_zap_caches(inode);
}
@@ -547,9 +552,13 @@
inode->i_fop = &cfs_file_operations;
inode->i_data.a_ops = &cfs_file_aops;
#ifdef CFS_READAHEAD
+#ifdef CFS_BDI
+ inode->i_mapping->backing_dev_info = &itocmi(inode)->backing_dev_info;
+#else
inode->i_mapping->backing_dev_info->ra_pages =
itocmi(inode)->rpages * CFS_MAX_READAHEAD;
#endif
+#endif
} else if (S_ISDIR(inode->i_mode)) {
inode->i_op = &cfs_dir_inode_operations;
inode->i_fop = &cfs_dir_operations;
@@ -591,7 +600,7 @@
__wait_on_new_inode(inode);
}
-static int
+int
cfs_find_actor(struct inode *inode, void *opaque)
{
struct cfs_find_desc *desc = (struct cfs_find_desc *)opaque;
@@ -600,21 +609,19 @@
if (desc->cdrok) {
if (inode->i_ino != desc->cdrok->cdrok_attr.cna_ino)
return 0;
-#ifdef SSI_XXX
- /* SSI_XXX: This may be needed instead ? */
- if (memcmp (itocfh(inode), &(desc->cdrok->cdrok_fhandle),
- sizeof (cfhandle_t) != 0))
+#ifdef CFS_EXPORT_OPS
+ if (memcmp(itocfh(inode), &(desc->cdrok->cdrok_fhandle),
+ CFS_FH_LEN(&(desc->cdrok->cdrok_fhandle))))
return 0;
-#endif /* SSI_XXX */
+#endif
} else {
if (inode->i_ino != desc->hp->sct_ip->i_ino)
return 0;
-#ifdef SSI_XXX
- /* SSI_XXX: This may be needed instead ? */
- if (memcpy(itocfh(inode), &(desc->hp->sct_fh),
- sizeof (cfhandle_t) != 0))
+#ifdef CFS_EXPORT_OPS
+ if (memcmp(itocfh(inode), &(desc->hp->sct_fh),
+ CFS_FH_LEN(&(desc->hp->sct_fh))))
return 0;
-#endif /* SSI_XXX */
+#endif
}
if (is_bad_inode(inode))
return 0;
@@ -638,7 +645,7 @@
itoc(inode)->c_locknumber = desc->cdrok->cdrok_locknumber;
- inode->i_ino = desc->cdrok->cdrok_attr.cna_ino;
+ //inode->i_ino = desc->cdrok->cdrok_attr.cna_ino;
} else {
SSI_ASSERT (desc->hp);
@@ -651,7 +658,7 @@
itoc(inode)->c_locknumber = (void *) &(desc->hp->sct_mhold);
- inode->i_ino = desc->hp->sct_ip->i_ino;
+ //inode->i_ino = desc->hp->sct_ip->i_ino;
}
return 0;
@@ -739,7 +746,6 @@
if (inode->i_state & I_NEW) {
/* We set i_ino for the few things that still rely on it,
* such as stat(2) */
- /* SSI_XXX: redundant? i_ino set in cfs_init_locked */
inode->i_ino = ino;
/* Get MHOLD for client at server CFS inode */
@@ -867,8 +873,7 @@
#ifdef CFS_SETATTR_LAZY_FLUSH
/* Write all dirty data if we're changing file permissions or size */
if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE)) != 0) {
- if (filemap_fdatawrite(inode->i_mapping) == 0)
- filemap_fdatawait(inode->i_mapping);
+ filemap_write_and_wait(inode->i_mapping);
cfs_wb_all(inode);
}
#else
@@ -950,14 +955,43 @@
int
cfs_wait_on_inode(struct inode *inode, int flag)
{
+#ifdef CFS_INTR
+ cfs_mntinfo_t *mip = itocmi(inode);
+ sigset_t oldmask;
+#endif
int error;
+
+#ifdef CFS_FLAGS_BITOPS
+ cfs_clnt_sigmask(mip, &oldmask);
+ error = wait_on_bit_lock(&mip->mi_flags, CFS_INO_REVALIDATING,
+ cfs_wait_schedule, TASK_INTERRUPTIBLE);
+ cfs_clnt_sigunmask(mip, &oldmask);
+#else
if (!(CFS_FLAGS(inode) & flag))
return 0;
atomic_inc(&inode->i_count);
+#ifdef CFS_INTR
+ cfs_clnt_sigmask(mip, &oldmask);
+ error = wait_event_interruptible(itoc(inode)->c_i_wait, !(CFS_FLAGS(inode) & flag));
+ cfs_clnt_sigunmask(mip, &oldmask);
+#else
error = cfs_wait_event(itoc(inode)->c_i_wait, !(CFS_FLAGS(inode) & flag));
+#endif
iput(inode);
- return error;
+#endif
+ return error;
}
+
+#ifdef CFS_FLAGS_BITOPS
+static void cfs_wake_up_inode(struct inode *inode)
+{
+ cfs_mntinfo_t *mip = itocmi(inode);
+
+ clear_bit(CFS_INO_REVALIDATING, &mip->mi_flags);
+ smp_mb__after_clear_bit();
+ wake_up_bit(&mip->mi_flags, CFS_INO_REVALIDATING);
+}
+#endif
#endif
#ifdef SSI_EXNFS
@@ -1725,9 +1759,11 @@
/* Initialize Message Support code */
msgsup_init(); /* msgsup_msg_cache, msgsup_id_cache */
+#ifdef SSI_RANGE_TOKENS
/* Initialize Range token code */
cliglue_global_init();
svrglue_global_init();
+#endif
/* Initialize Token Sequencing structures */
cfs_tsp = tokseq_new(NSC_MAX_NODE_VALUE);
@@ -2112,19 +2148,19 @@
static struct dentry *
cfs_get_dentry(struct super_block *sb, void *vobjp)
{
- __u32 *data = vobjp;
+ cfhandle_t *fhp = (cfhandle_t *)vobjp;
struct inode *inode;
struct dentry *dentry;
/*
* Attempt to find the inode.
*/
- inode = ilookup(sb, data[3]);
+ inode = clifhtoip(fhp);
if (!inode) {
int error;
error = CFS_PROTO(sb->s_root->d_inode)->getinode(sbtocmi(sb),
- (cfhandle_t *)data,
+ fhp,
&inode);
switch (error) {
case 0:
Index: file.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/file.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- file.c 3 Feb 2009 06:18:12 -0000 1.22
+++ file.c 24 Mar 2009 04:26:28 -0000 1.23
@@ -68,6 +68,11 @@
static int cfs_file_flush(struct file *);
static int cfs_fsync(struct file *, struct dentry *dentry, int datasync);
+static int cfs_lock(struct file *, int, struct file_lock *);
+#ifdef CFS_FLOCK
+static int cfs_flock(struct file *, int, struct file_lock *);
+#endif
+
struct file_operations cfs_file_operations = {
.llseek = cfs_file_llseek,
.read = do_sync_read,
@@ -82,6 +87,9 @@
#endif
.fsync = cfs_fsync,
.lock = cfs_lock,
+#ifdef CFS_FLOCK
+ .flock = cfs_flock,
+#endif
.sendfile = cfs_file_sendfile,
};
@@ -123,9 +131,8 @@
/* For performance, assume that only origin == 2 needs size inode
* field.
*/
- if (origin == 2)
+ if (origin == 2) {
#ifdef CFSTOK_INTR
- {
int status;
status = cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
@@ -136,11 +143,18 @@
#endif
return -EINTR;
}
- }
#else
(void)cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#endif
+#ifdef KERNEL2616_53
+#ifdef SSI_EXNFS
+ int retval = cfs_revalidate_file_size(inode, filp);
+ if (retval < 0)
+ return (loff_t)retval;
+#endif
+#endif
+ }
/* SSI_XXX: Subtle diff with default_llseek() & generic_file_llseek() */
result = remote_llseek(file, offset, origin);
@@ -191,7 +205,11 @@
file->f_error = 0;
#ifdef CFS_ZAP_CACHES
if (!status)
- (void)__cfs_revalidate_inode(inode);
+#ifdef KERNEL2616_53
+ cfs_revalidate_inode(inode);
+#else
+ __cfs_revalidate_inode(inode);
+#endif
#endif
}
@@ -664,11 +682,8 @@
.fl_compare_owner = cfs_same_owner,
};
-/*
- * Lock a (portion of) a file
- */
-int
-cfs_lock(struct file *filp, int cmd, struct file_lock *fl)
+static int
+__cfs_lock(struct file *filp, int cmd, struct file_lock *fl)
{
struct inode * inode = filp->f_dentry->d_inode;
cfs_mntinfo_t *mip = itocmi(inode);
@@ -678,25 +693,6 @@
int new_lock = 0;
#endif
- dprintk("CFS: cfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%Ld:%Ld)\n",
- inode->i_sb->s_dev, inode->i_ino,
- fl->fl_type, fl->fl_flags,
- (long long)fl->fl_start, (long long)fl->fl_end);
-
- if (!inode)
- return -EINVAL;
-
- /* For unlock don't tell the server, our pid must still exist. */
- if ((fl->fl_type == F_UNLCK) && ssi_vproc_destroy(current))
- return 0; /* Let base code clean-up mirror */
-
- /* No mandatory locks over CFS */
- if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
- return -ENOLCK;
-
- if (!fl->fl_owner || !(fl->fl_flags & FL_POSIX))
- return -ENOLCK;
-
la.cfrla_fh = *itocfh(inode);
la.cfrla_start = fl->fl_start;
la.cfrla_end = fl->fl_end;
@@ -739,7 +735,16 @@
#endif
} else if (IS_GETLK(cmd)) {
struct cfsgetlockres res;
+#ifdef KERNEL2616_53
+ struct file_lock *cfl;
+ /* Try local locking first */
+ cfl = posix_test_lock(filp, fl);
+ if (cfl != NULL) {
+ locks_copy_lock(fl, cfl);
+ goto sb_error_check;
+ }
+#endif
if (CFS_AT_SERVER(inode)) {
cfsd_proc_getlock_0(&la, &res);
} else {
@@ -783,7 +788,7 @@
SSI_ASSERT(!err);
}
}
-#endif
+#endif /* !CFS_MIRROR_LOCK_WAIT */
sb_error_check:
if (CFS_SB_RETRY(mip, status))
@@ -807,6 +812,75 @@
return status;
}
+/*
+ * Lock a (portion of) a file
+ */
+static int cfs_lock(struct file *filp, int cmd, struct file_lock *fl)
+{
+ struct inode * inode = filp->f_dentry->d_inode;
+
+ dprintk("CFS: cfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%Ld:%Ld)\n",
+ inode->i_sb->s_dev, inode->i_ino,
+ fl->fl_type, fl->fl_flags,
+ (long long)fl->fl_start, (long long)fl->fl_end);
+
+ if (!inode)
+ return -EINVAL;
+
+ /* For unlock don't tell the server, our pid must still exist. */
+ if ((fl->fl_type == F_UNLCK) && ssi_vproc_destroy(current))
+ return 0; /* Let base code clean-up mirror */
+
+ /* No mandatory locks over CFS */
+#ifdef KERNEL2616_53
+ if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
+ fl->fl_type != F_UNLCK)
+#else
+ if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+#endif
+ return -ENOLCK;
+
+ return __cfs_lock(filp, cmd, fl);
+}
+
+#ifdef CFS_FLOCK
+/*
+ * Lock a (portion of) a file
+ */
+static int cfs_flock(struct file *filp, int cmd, struct file_lock *fl)
+{
+ struct inode * inode = filp->f_mapping->host;
+
+ dprintk("CFS: cfs_flock(f=%s/%ld, t=%x, fl=%x)\n",
+ inode->i_sb->s_id, inode->i_ino,
+ fl->fl_type, fl->fl_flags);
+
+ if (!inode)
+ return -EINVAL;
+
+ /* For unlock don't tell the server, our pid must still exist. */
+ if ((fl->fl_type == F_UNLCK) && ssi_vproc_destroy(current))
+ return 0; /* Let base code clean-up mirror */
+
+ /*
+ * No BSD flocks over CFS allowed.
+ * Note: we could try to fake a POSIX lock request here by
+ * using ((u32) filp | 0x80000000) or some such as the pid.
+ * Not sure whether that would be unique, though, or whether
+ * that would break in other places.
+ */
+ if (!(fl->fl_flags & FL_FLOCK))
+ return -ENOLCK;
+
+ /* We're simulating flock() locks using posix locks on the server */
+ fl->fl_owner = (fl_owner_t)filp;
+ fl->fl_start = 0;
+ fl->fl_end = OFFSET_MAX;
+
+ return __cfs_lock(filp, cmd, fl);
+}
+#endif /* CFS_FLOCK */
+
static int
cfs_dev_open(struct inode *ip, struct file *fp)
{
Index: pagelist.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/pagelist.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pagelist.c 10 Oct 2008 08:10:31 -0000 1.12
+++ pagelist.c 24 Mar 2009 04:26:28 -0000 1.13
@@ -239,11 +239,11 @@
}
#ifdef KERNEL2616_53
-static int cfs_wait_on_bit_interruptible(void *word)
+static int cfs_wait_bit_interruptible(void *word)
{
int ret = 0;
-#ifdef CFS_NOINTR
+#ifdef CFS_INTR
if (signal_pending(current))
ret = -ERESTARTSYS;
else
@@ -267,12 +267,26 @@
return 0;
return cfs_wait_event(req->wb_wait, !CFS_WBACK_BUSY(req));
#else
-#ifdef CFS_NOINTR
- return wait_on_bit(&req->wb_flags, PG_BUSY,
- cfs_wait_on_bit_interruptible, TASK_INTERRUPTIBLE);
+#ifdef CFS_INTR
+ cfs_mntinfo_t *mip = itocmi(req->wb_inode);
+ sigset_t oldmask;
+ int ret = 0;
+
+ if (!test_bit(PG_BUSY, &req->wb_flags))
+ goto out;
+ /*
+ * Note: the call to rpc_clnt_sigmask() suffices to ensure that we
+ * are not interrupted if intr flag is not set
+ */
+ cfs_clnt_sigmask(mip, &oldmask);
+ ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY,
+ cfs_wait_bit_interruptible, TASK_INTERRUPTIBLE);
+ cfs_clnt_sigunmask(mip, &oldmask);
+out:
+ return ret;
#else
return wait_on_bit(&req->wb_flags, PG_BUSY,
- cfs_wait_on_bit_interruptible, TASK_UNINTERRUPTIBLE);
+ cfs_wait_bit_interruptible, TASK_UNINTERRUPTIBLE);
#endif
#endif /* KERNEL2616_53 */
}
Index: dir.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/dir.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dir.c 19 Feb 2009 08:01:01 -0000 1.25
+++ dir.c 24 Mar 2009 04:26:28 -0000 1.26
@@ -95,7 +95,10 @@
.rmdir = cfs_rmdir,
.mknod = cfs_mknod,
.rename = cfs_rename,
+#ifdef SSI_CFS_SKIP
+/* SSI: correct but redundant. See functions calling _cfs_permission() */
.permission = cfs_permission,
+#endif
.getattr = cfs_getattr,
.setattr = cfs_setattr,
};
@@ -145,6 +148,9 @@
if (error < 0)
goto error;
SetPageUptodate(page);
+ LOCK_COND_LOCK(&itoc(inode)->c_statelock);
+ CFS_FLAGS(inode) |= CFS_INO_INVALID_ATIME;
+ UNLOCK_COND_LOCK(&itoc(inode)->c_statelock);
kunmap(page);
/* Ensure consistent page alignment of the data.
* Note: assumes we have exclusive access to this mapping either
@@ -351,11 +357,9 @@
desc->error = CFS_PROTO(inode)->readdir(inode, desc->target,
desc->ptr,
PAGE_CACHE_SIZE);
-#ifdef SSI_CFS_SKIP
LOCK_COND_LOCK(&itoc(inode)->c_statelock);
CFS_FLAGS(inode) |= CFS_INO_INVALID_ATIME;
UNLOCK_COND_LOCK(&itoc(inode)->c_statelock);
-#endif
if (desc->error >= 0) {
if ((status = cfs_dir_decode(desc)) == 0)
desc->entry->prev_cookie = desc->target;
@@ -369,7 +373,6 @@
/* Reset read descriptor so it searches the page cache from
* the start upon the next call to readdir_search_pagecache() */
desc->page_index = 0;
- //memset(desc->entry, 0, sizeof(*desc->entry));
desc->entry->cookie = desc->entry->prev_cookie = 0;
desc->entry->eof = 0;
out:
@@ -753,7 +756,12 @@
#endif
/* Revalidate parent directory attribute cache */
+#ifdef KERNEL2616_53
+ if (cfs_revalidate_inode(dir) < 0)
+ goto out_zap_parent;
+#else
(void) cfs_revalidate_inode(dir);
+#endif
/* Force a full look up iff the parent directory has changed */
if (cfs_check_verifier(dir, dentry)) {
@@ -901,7 +909,7 @@
if (dcd)
kfree(dcd);
- vdc2dcd(dentry) = NULL;
+ dentry->d_fsdata = NULL;
}
struct dentry_operations cfs_dentry_operations = {
@@ -910,7 +918,11 @@
d_release: cfs_drelease,
};
-#ifdef SSI_EXNFS_XXX
+#ifdef KERNEL2616_53
+/*
+ * Use intent information to check whether or not we're going to do
+ * an O_EXCL create using this path component.
+ */
static inline int
cfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
{
@@ -960,6 +972,17 @@
res = ERR_PTR(error);
goto release_out;
}
+#ifdef KERNEL2616_53
+ /*
+ * If we're doing an exclusive create, optimize away the lookup
+ * but don't hash the dentry.
+ */
+ if (cfs_is_exclusive_create(dir, nd)) {
+ d_instantiate(dentry, NULL);
+ res = NULL;
+ goto release_out;
+ }
+#else
#ifdef CFS_ZAP_CACHES
/* Revalidate parent directory attribute cache */
(void) cfs_revalidate_inode(dir);
@@ -971,6 +994,7 @@
if (cfs_is_exclusive_create(dir, nd))
goto no_entry;
#endif
+#endif /* !KERNEL2616_53 */
error = CFS_PROTO(dir)->lookup(dir, &dentry->d_name, &inode);
if (!error || error == -ENOENT) {
@@ -986,7 +1010,6 @@
if (!vdc2dcd(dentry)) {
dcd->dc_vn = itoc(dir)->c_vn;
vdc2dcd(dentry) = dcd;
- mb();
dcd = NULL; /* So it won't be free'd */
}
} else
@@ -1408,7 +1431,9 @@
if ((error = _cfs_permission(dir, MAY_WRITE|MAY_EXEC)))
goto release_out;
+#ifndef KERNEL2616_53
d_drop(dentry);
+#endif
#ifndef CFS_ZAP_CACHES
/* SSI_XXX: Can't cfs_zap_caches() race with readdir?
@@ -1418,14 +1443,15 @@
cfs_begin_data_update(dir);
cfs_begin_data_update(inode);
error = CFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
- cfs_end_data_update(inode);
- cfs_end_data_update(dir);
-#ifdef NOTYET_REFCOUNT_BUG
- if (!error) {
+#ifdef KERNEL2616_53
+/* #ifdef NOTYET_REFCOUNT_BUG */
+ if (error == 0) {
atomic_inc(&inode->i_count);
d_instantiate(dentry, inode);
}
#endif
+ cfs_end_data_update(inode);
+ cfs_end_data_update(dir);
release_out:
cfstok_relse_list(&held);
@@ -1433,6 +1459,7 @@
return error;
}
+#ifndef CFS_ZAP_CACHES
/**
* cfs_is_subdir - Return TRUE if @new_dentry is a subdir of @old_dentry
* @new_dentry:
@@ -1459,6 +1486,7 @@
error = -ENOENT;
return error;
}
+ /* SSI_XXX: need locking */
new_dentry = new_dentry->d_parent;
continue;
}
@@ -1469,6 +1497,7 @@
return ret;
}
+#endif
/**
@@ -1485,7 +1514,7 @@
cfs_rename(struct inode *odir, struct dentry *odentry,
struct inode *ndir, struct dentry *ndentry)
{
- struct inode *ip = odentry->d_inode, *nip = NULL;
+ struct inode *ip = odentry->d_inode, *nip = ndentry->d_inode;
cfs_lockop_t lock[4];
int num_lock;
int dir_rename = FALSE;
@@ -1497,6 +1526,8 @@
ndentry->d_parent->d_name.name, ndentry->d_name.name,
atomic_read(&ndentry->d_count));
+
+#ifdef SSI_CFS_SKIP
if (ndentry->d_inode) {
nip = ndentry->d_inode;
@@ -1506,11 +1537,19 @@
goto fail;
}
}
+#endif
cfstok_hl_init(&held);
- /* Make sure we aren't trying to move a directory into it's subdir */
-
+#ifdef KERNEL2616_53
+ if (!nip)
+ goto go_ahead;
+ if (S_ISDIR(nip->i_mode)) {
+ /* error = gfs_glock(sdp, sdp->sd_rename_gl, 0); */
+ error = -EISDIR;
+ if (!S_ISDIR(ip->i_mode))
+ goto fail_renlock;
+#else
if (S_ISDIR(ip->i_mode) && odir != ndir) {
#ifdef SSI_CFS_XXX
/* SSI_XXX: Need super block rename token here */
@@ -1519,6 +1558,9 @@
goto fail;
#endif
+#ifndef CFS_ZAP_CACHES
+ /* SSI: done in base */
+ /* Make sure we aren't trying to move a directory into it's subdir */
error = cfs_is_subdir(ndentry->d_parent, odentry);
switch (error) {
case TRUE:
@@ -1531,10 +1573,17 @@
goto fail_renlock;
break;
}
+#endif
+#endif /* !KERNEL2616_53 */
dir_rename = TRUE;
}
+#ifdef KERNEL2616_53
+ else if (!(atomic_read(&ndentry->d_count) > 2))
+ nip->i_nlink--;
+go_ahead:
+#endif
lock[0].lo_ip = odir;
lock[0].lo_which = CFSTOK_ATTR;
lock[0].lo_mode = CFSTOK_EXCL;
@@ -1569,6 +1618,8 @@
if (error)
goto fail_gunlock;
+#ifdef SSI_CFS_SKIP
+/* Paranoid? */
if (!cfs_lookup_revalidate(odentry, 0)) {
/* SSI_XXX: Source file has changed while getting tokens,
* but we aren't in a position to conitinue with this
@@ -1578,7 +1629,7 @@
error = -ENOENT;
goto fail_gunlock;
}
-
+#endif
/* Check out the new directory */
@@ -1586,6 +1637,8 @@
if (error)
goto fail_gunlock;
+#ifdef SSI_CFS_SKIP
+/* Paranoid? */
if (nip) {
if (!cfs_lookup_revalidate(ndentry, 0)) {
/* SSI_XXX: Target has changed while getting tokens,
@@ -1615,6 +1668,7 @@
goto fail_gunlock;
};
}
+#endif
/*
* ... prune child dentries and writebacks if needed.
@@ -1628,6 +1682,13 @@
}
#endif
+#ifdef KERNEL2616_53
+ if (!d_unhashed(ndentry))
+ d_drop(ndentry);
+ if (nip)
+ d_delete(ndentry);
+#endif
+
cfs_begin_data_update(ndir);
cfs_begin_data_update(odir);
cfs_begin_data_update(ip);
@@ -1649,8 +1710,9 @@
if (dir_rename)
gfs_gunlock(sdp, sdp->sd_rename_gl, 0);
#endif
-
+#ifdef SSI_CFS_SKIP
fail:
+#endif
return error;
}
@@ -1663,8 +1725,40 @@
int
cfs_permission(struct inode *inode, int mask, struct nameidata *nd)
{
- int error;
int result;
+#ifdef KERNEL2616_53
+ int res = 0;
+
+ if (mask == 0)
+ goto out;
+ /* Is this sys_access() ? */
+ if (nd != NULL && (nd->flags & LOOKUP_ACCESS))
+ goto force_lookup;
+
+ switch (inode->i_mode & S_IFMT) {
+ case S_IFLNK:
+ goto out;
+ case S_IFREG:
+#ifdef SSI_EXNFS
+ /* NFSv4 has atomic_open... */
+ if (nfs_server_capable(inode, NFS_CAP_ATOMIC_OPEN)
+ && nd != NULL
+ && (nd->flags & LOOKUP_OPEN))
+ goto out;
+#endif
+ break;
+ case S_IFDIR:
+ /*
+ * Optimize away all write operations, since the server
+ * will check permissions when we perform the op.
+ */
+ if ((mask & MAY_WRITE) && !(mask & MAY_READ))
+ goto out;
+ }
+
+force_lookup:
+#else /* !KERNEL2616_53 */
+ int error;
/* Are we checking permissions on anything other than lookup/execute? */
if ((mask & MAY_EXEC) == 0) {
@@ -1677,6 +1771,7 @@
return 0;
#endif
}
+#endif /* !KERNEL2616_53 */
/* In order to properly verify the permission in the cluster, we must
* update the attributes under tokens. This function is called
@@ -1694,13 +1789,22 @@
#else
SSI_ASSERT(result == CFSTOK_HELD);
#endif
+#ifdef KERNEL2616_53
+ res = cfs_revalidate_inode(inode);
+ if (res == 0)
+ res = generic_permission(inode, mask, NULL);
+ cfstok_relse(inode, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
+out:
+ return res;
+#else
//(void)cfs_revalidate_inode(inode, 1);
error = _cfs_permission(inode, mask);
cfstok_relse(inode, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
return error;
+#endif
}
/*
Index: cfstok.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfstok.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cfstok.c 3 Feb 2009 06:18:12 -0000 1.20
+++ cfstok.c 24 Mar 2009 04:26:28 -0000 1.21
@@ -44,6 +44,9 @@
#ifdef SSI_CFS_FASTPATH
#include <cluster/ssi/cfs/cfs_fast.h>
#endif
+#ifdef CFS_EXPORT_OPS
+#include <cluster/ssi/cfs/cfsfh.h>
+#endif
#include <cluster/ssi/token/comtok.h>
#include <cluster/ssi/token/token.h>
@@ -1611,7 +1614,11 @@
goto out;
}
+#ifdef CFS_EXPORT_OPS
+ memcpy(&ctargs.cta_fhandle, fhp, CFS_FH_LEN(fhp));
+#else
ctargs.cta_fhandle = *fhp;
+#endif
ctargs.cta_agent = agent;
ctargs.cta_op = op;
ctargs.cta_type = type;
@@ -1909,7 +1916,11 @@
/* Set don't cache tokens for cfs_inactive() */
LOCK_COND_LOCK(&(cp->c_statelock));
+#ifdef SVRCFSTOK_SCT_FLAGS_NOLOCK
+ if (test_bit(CFS_NOTOKENCACHE, &flags))
+#else
if (flags & CFS_NOTOKENCACHE)
+#endif
cp->c_flags |= CNOTOKENCACHE;
else
cp->c_flags &= ~CNOTOKENCACHE;
@@ -1954,7 +1965,7 @@
ip = clifhtoip(tfhp);
if (ip) {
- d_purge_aliases(ip);
+ d_prune_aliases(ip);
iput(ip);
}
@@ -2008,7 +2019,7 @@
#ifdef SVRHOLD_LIST_LINUX_LIST
list_for_each_entry_safe(item, tmp, hlistp, hl_list) {
- list_del(&item->hl_list);
+ list_del_init(&item->hl_list);
#else
for (i = 0 ; i < count ; i++) {
item = hlist_extract(hlistp);
Index: write.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/write.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- write.c 3 Feb 2009 06:18:12 -0000 1.36
+++ write.c 24 Mar 2009 04:26:28 -0000 1.37
@@ -456,10 +456,16 @@
while (test_and_set_bit(BDI_cfs_write_congested,
&bdi->state) != 0) {
#endif
+#else /* !CFS_WRITEPAGES_AT_SVR_SKIP_BDI */
+#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
+ while (!flushing &&
+ test_and_set_bit(BDI_write_congested,
+ &bdi->state) != 0) {
#else
while (test_and_set_bit(BDI_write_congested,
&bdi->state) != 0) {
#endif
+#endif /* !CFS_WRITEPAGES_AT_SVR_SKIP_BDI */
if (wbc->nonblocking)
return 0;
cfs_wait_on_write_congestion(mapping, 0);
@@ -505,14 +511,12 @@
err = 0;
}
out:
-#ifdef CFS_WRITEPAGES_AT_SVR_SKIP_BDI
#ifdef CFS_FILE_WRITE_LIVELOCK_FIX
if (flushing)
return err;
#endif
- smp_mb__before_clear_bit();
+#ifdef CFS_WRITEPAGES_AT_SVR_SKIP_BDI
clear_bit(BDI_cfs_write_congested, &bdi->state);
- smp_mb__after_clear_bit();
#else
clear_bit(BDI_write_congested, &bdi->state);
#endif
@@ -802,20 +806,24 @@
if (!bdi_write_congested(bdi))
#endif
return 0;
-#ifdef CFS_NOINTR
+#ifdef CFS_INTR
if (intr) {
- struct rpc_clnt *clnt = CFS_CLIENT(mapping->host);
+ cfs_mntinfo_t *mip = itocmi(mapping->host);
sigset_t oldset;
- rpc_clnt_sigmask(clnt, &oldset);
+ cfs_clnt_sigmask(mip, &oldset);
prepare_to_wait(&cfs_write_congestion, &wait, TASK_INTERRUPTIBLE);
+#ifdef CFS_WRITEPAGES_AT_SVR_SKIP_BDI
+ if (bdi_cfs_write_congested(bdi)) {
+#else
if (bdi_write_congested(bdi)) {
+#endif
if (signalled())
ret = -ERESTARTSYS;
else
schedule();
}
- rpc_clnt_sigunmask(clnt, &oldset);
+ cfs_clnt_sigunmask(mip, &oldset);
} else {
#endif
prepare_to_wait(&cfs_write_congestion, &wait, TASK_UNINTERRUPTIBLE);
@@ -825,7 +833,7 @@
if (bdi_write_congested(bdi))
#endif
schedule();
-#ifdef CFS_NOINTR
+#ifdef CFS_INTR
}
#endif
finish_wait(&cfs_write_congestion, &wait);
@@ -1751,15 +1759,11 @@
do {
error = 0;
- if (wait) {
+ if (wait)
error = cfs_wait_on_requests(inode, idx_start, npages);
- if (error != 0)
- continue;
- }
- error = cfs_flush_inode(inode, idx_start, npages, how);
- if (error != 0)
- continue;
- /* if (!nocommit) */
+ if (error == 0)
+ error = cfs_flush_inode(inode, idx_start, npages, how);
+ if (error == 0)
#ifndef KERNEL2613
error = cfs_commit_inode(inode, idx_start, npages, how);
#else
Index: cfs_mnthooks.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfs_mnthooks.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cfs_mnthooks.c 19 Feb 2009 08:01:01 -0000 1.23
+++ cfs_mnthooks.c 24 Mar 2009 04:26:28 -0000 1.24
@@ -273,8 +273,7 @@
int
cfs_shm_notify(struct super_block *sb, clusternode_t node, int flags)
{
- struct dentry *root_dentry = sb->s_root;
- struct inode *root = root_dentry->d_inode;
+ struct inode *root = sb->s_root->d_inode;
struct svrcfstok *hp = itoc(root)->c_hp;
struct cfsmountargs args;
nsc_handle_t *th;
@@ -328,8 +327,7 @@
cfs_notify_all(struct vfsmount *mnt, struct nameidata *nd, int flags)
{
struct super_block *sb = mnt->mnt_sb;
- struct dentry *root_dentry = sb->s_root;
- struct inode *root = root_dentry->d_inode;
+ struct inode *root = sb->s_root->d_inode;
struct svrcfstok *hp = itoc(root)->c_hp;
struct cfsmountargs args;
nsc_nodelist_t *nl;
@@ -826,8 +824,6 @@
if (sbtocmi(sb)->mi_flags & MI_CHARD)
*flags |= MS_CHARD;
- hp = itoc(root)->c_hp;
-
cmap->flags = *flags;
if (sbtocmi(sb)->mi_flags & MI_SB_DOWN)
cmap->server = CLUSTERNODE_INVAL;
@@ -835,6 +831,7 @@
cmap->server = sbtocmi(sb)->mi_server;
cmap->root.cdrok_fhandle = *itocfh(root);
+ hp = itoc(root)->c_hp;
if (hp)
cfsd_getattr(hp, &(cmap->root.cdrok_attr));
else
Index: cfsproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfsproc.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cfsproc.c 22 Feb 2009 04:15:37 -0000 1.32
+++ cfsproc.c 24 Mar 2009 04:26:28 -0000 1.33
@@ -48,7 +48,11 @@
{
struct svrcfstok *hp;
+#ifdef RCU_CFSTOK_TABLE
+ hp = hfind(fh);
+#else
hp = svrtok_lookup(fh, NULL, NULL);
+#endif
if (hp == NULL)
panic("fhtohp: Can't find hash structure");
/* No need to HASH_HOLD() held by svrtok_lookup() */
@@ -243,7 +247,11 @@
}
/* SSI_XXX: A waste, but I wanted to use cfsdiropres for convenience */
+#ifdef CFS_EXPORT_OPS
+ memcpy(&resp->cdr_fhandle, &hp->sct_fh, CFS_FH_LEN(&hp->sct_fh));
+#else
resp->cdr_fhandle = hp->sct_fh;
+#endif
resp->cdr_locknumber = (void *)&(hp->sct_mhold);
/* Must get MHOLD, ATTR tokens first */
@@ -362,7 +370,11 @@
*/
cfserr = cfsd_lookup(dhp, &(argp->clua_name), &hp);
if (!cfserr) {
+#ifdef CFS_EXPORT_OPS
+ memcpy(&resp->cdr_fhandle, &hp->sct_fh, CFS_FH_LEN(&hp->sct_fh));
+#else
resp->cdr_fhandle = hp->sct_fh;
+#endif
resp->cdr_locknumber = (void *)&(hp->sct_mhold);
/* Must get MHOLD, ATTR tokens first */
@@ -736,7 +748,11 @@
/* SSI_XXX: Need error checking for EXNFS */
cfsd_getattr(dhp, &resp->ccr_dirattr);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&resp->ccr_fhandle, &hp->sct_fh, CFS_FH_LEN(&hp->sct_fh));
+#else
resp->ccr_fhandle = hp->sct_fh;
+#endif
get_lu_toks(hp, &new_hold_list, 0, argp->cca_agent);
/* SSI_XXX: Need error checking for EXNFS */
@@ -908,7 +924,11 @@
/* SSI_XXX: Need error checking for EXNFS */
cfsd_getattr(dhp, &resp->ccr_dirattr);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&resp->ccr_fhandle, &hp->sct_fh, CFS_FH_LEN(&hp->sct_fh));
+#else
resp->ccr_fhandle = hp->sct_fh;
+#endif
get_lu_toks(hp, &new_hold_list, 0, argp->csla_agent);
@@ -963,7 +983,11 @@
/* SSI_XXX: Need error checking for EXNFS */
cfsd_getattr(dhp, &resp->ccr_dirattr);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&resp->ccr_fhandle, &hp->sct_fh, CFS_FH_LEN(&hp->sct_fh));
+#else
resp->ccr_fhandle = hp->sct_fh;
+#endif
get_lu_toks(hp, &new_hold_list, 0, argp->cca_agent);
/* SSI_XXX: Need error checking for EXNFS */
@@ -1262,7 +1286,9 @@
return;
}
+#ifndef CFS_VFSMOUNT_RACE_FIX
mntget(mnt);
+#endif
#ifdef CFS_MIGRATE_ACTIVE_PFS
if (argp->flags & MNT_DETACH) {
@@ -1312,12 +1338,15 @@
printk("cfsd_proc_umount_0; Can't find vfsmount\n");
BUG();
}
+#ifdef CFS_VFSMOUNT_RACE_FIX
+ _mntput(mnt); /* for the lookup */
+#endif
/* vfsmount should have the right number of holds due to prep above. */
retval = do_umount(mnt, argp->flags);
- mntput(mnt);
+ _mntput(mnt);
*status = retval;
return;
@@ -1337,8 +1366,10 @@
BUG();
}
+#ifdef CFS_VFSMOUNT_RACE_FIX
+ _mntput(mnt); /* for the lookup */
+#endif
/* SSI_XXX: Release lock held in prep umount above */
-
mntput(mnt);
*status = 0;
@@ -1361,7 +1392,9 @@
BUG();
}
+#ifndef CFS_VFSMOUNT_RACE_FIX
mntget(mnt);
+#endif
sb = mnt->mnt_sb;
shrink_dcache_sb(sb);
@@ -1391,7 +1424,9 @@
BUG();
}
+#ifndef CFS_VFSMOUNT_RACE_FIX
mntget(mnt);
+#endif
sb = mnt->mnt_sb;
sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (argp->flags & MS_RMT_MASK);
@@ -1554,11 +1589,10 @@
int prevmode;
int ret;
int error = CFS_OK;
-#ifdef CFS_DECODE_FH
- int decode_fh = 0;
-#endif
+#ifndef CFS_FH_TO_DENTRY_ANON
struct inode *ip;
- struct dentry *dp = NULL;
+#endif
+ struct dentry *dp;
#ifdef SKIP
dprintk("cfsd_proc_haverpc_0: agent %d ropn %d wopn %d\n",
@@ -1571,12 +1605,6 @@
if (hp == NULL) {
/* No: try to build it. */
struct super_block *sb, *pfs_sb;
-#ifdef DEBUG
- extern int havesvget_nodes;
- extern clock_t havesvget_ticks;
- extern clock_t havesbuild_ticks;
- clock_t op_ticks = lbolt;
-#endif
sb = ssi_get_super(((__u32 *)fhp)[0]);
SSI_ASSERT(sb);
@@ -1588,68 +1616,49 @@
SSI_ASSERT(sb->s_type == cfs_fstype);
pfs_sb = sbtocmi(sb)->mi_pfs_sb;
-#ifndef CFS_DECODE_FH
- ip = iget(pfs_sb, ((__u32 *)fhp)[3]);
-#else
- /* NB: iget() depreciated on some PFS */
- if (pfs_sb->s_op->read_inode)
- ip = iget(pfs_sb, ((__u32 *)fhp)[3]);
- else { /* clifhtoip(fhp) wouldn't work */
- struct export_operations *nops = pfs_sb->s_export_op;
- int fh_len = ((__u32 *)fhp)[1];
- int fh_type = ((__u32 *)fhp)[2];
-#ifndef CFS_EXPORT_OPS
- __u32 fht[2];
- __u32 *datap = fht;
-
- /* SSI_XXX old style */
- fht[0] = ((__u32 *)fhp)[3]; /* i_ino */
- fht[1] = ((__u32 *)fhp)[4]; /* i_generation */
-
- dp = CALL(nops,decode_fh)(pfs_sb, datap, fh_len, fh_type,
- cfsd_acceptable, NULL);
-#else
- __u32 *datap = (__u32 *)fhp;
-
- /* skip ssidev, size, type, ino */
- dp = CALL(nops,decode_fh)(pfs_sb, datap+4, fh_len, fh_type,
- cfsd_acceptable, NULL);
-#endif
- if (dp == NULL) {
- drop_super(sb);
- printk(KERN_WARNING "cfsd_proc_haverpc_0: decode_fh returned NULL\n");
- error = -ESTALE;
- goto out;
- }
+#ifdef CFS_FH_TO_DENTRY_ANON
+ if (!pfs_sb->s_op->read_inode) {
+ /* SSI_XXX: -ESTALE ext3 i_generation mismatch
+ * when using export_op_default
+ */
+ dp = __cfs_get_dentry(sb, fhp);
if (IS_ERR(dp)) {
drop_super(sb);
- printk(KERN_ERR "cfsd_proc_haverpc_0: decode_fh failure\n");
+ printk("crfs_haverpc_0: __cfs_get_dentry failure\n");
error = PTR_ERR(dp);
goto out;
}
- decode_fh = 1;
- }
-#endif /* CFS_DECODE_FH */
+ hp = svrtok_lookup(fhp, dp, sb);
+ SSI_ASSERT(hp);
+ dput(dp);
+ drop_super(sb);
+ } else {
+ struct inode *ip;
+#endif /* CFS_FH_TO_DENTRY_ANON */
#ifdef DEBUG
- havesiget_nodes++;
- havesiget_ticks += lbolt - op_ticks;
-#endif
-#ifdef CFS_DECODE_FH
- if (!decode_fh)
+ extern int havesvget_nodes;
+ extern clock_t havesvget_ticks;
+ extern clock_t havesbuild_ticks;
+ clock_t op_ticks = lbolt;
#endif
- if (ip == NULL) {
- drop_super(sb);
- printk("crfs_haverpc_0: iget failure\n");
- error = -ESTALE;
- goto out;
- }
+
+ /* SSI_XXX: iget() depreciated on some PFS */
+ ip = iget(pfs_sb, ((__u32 *)fhp)[3]);
+
#ifdef DEBUG
- op_ticks = lbolt;
+ havesiget_nodes++;
+ havesiget_ticks += lbolt - op_ticks;
#endif
-#ifdef CFS_DECODE_FH
- if (!decode_fh) {
+ if (ip == NULL) {
+ drop_super(sb);
+ printk("crfs_haverpc_0: iget failure\n");
+ error = -ESTALE;
+ goto out;
+ }
+#ifdef DEBUG
+ op_ticks = lbolt;
#endif
/* Special case the root inode, so we don't end up with two
* dentries which caused orphan inode problems.
@@ -1658,19 +1667,20 @@
iput(ip);
dp = dget(pfs_sb->s_root);
} else
- dp = d_alloc_root(ip);
-#ifdef CFS_DECODE_FH
- }
-#endif
+ //dp = d_alloc_root(ip); /* SSI_XXX */
+ dp = d_alloc_anon(ip);
- hp = svrtok_lookup(fhp, dp, sb);
- drop_super(sb);
+ hp = svrtok_lookup(fhp, dp, sb);
+ drop_super(sb);
#ifdef DEBUG
- havesbuild_ticks += lbolt - op_ticks;
+ havesbuild_ticks += lbolt - op_ticks;
+#endif
+ SSI_ASSERT(hp);
+ dput(dp);
+#ifdef CFS_FH_TO_DENTRY_ANON
+ }
#endif
- SSI_ASSERT(hp);
- dput(dp);
}
ret = svrcfstok_getinstall_range(hp, CFSTOK_MHOLD, CFSTOK_READ,
@@ -1823,14 +1833,12 @@
locks_init_lock(&fl);
-//nofail:
+nofail:
error = cfs_setup_sct_fp(hp);
- BUG_ON(error); /* SSI_XXX: need error handling? */
-#if 0
- /* SSI_XXX: could busy spin */
- if (error)
+ if (error) {
+ BUG_ON(error != -ENOMEM);
goto nofail;
-#endif
+ }
filp = hp->sct_fp;
SSI_ASSERT(filp->f_dentry->d_inode == inode);
Index: proc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/proc.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- proc.c 3 Feb 2009 06:18:12 -0000 1.19
+++ proc.c 24 Mar 2009 04:26:28 -0000 1.20
@@ -173,7 +173,7 @@
#ifdef CFS_FH_TO_DENTRY_ANON
struct svrcfstok *hp;
- hp = cfs_fhtohp((cfhandle_t *)fhandle);
+ hp = cfs_fhtohp(fhandle);
if (IS_ERR(hp)) {
status = PTR_ERR(hp);
hp = NULL;
Index: svrcfs.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/svrcfs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- svrcfs.c 22 Feb 2009 04:15:37 -0000 1.23
+++ svrcfs.c 24 Mar 2009 04:26:28 -0000 1.24
@@ -214,8 +214,11 @@
int i;
fhpp = (u_char *)fhp;
- /* i = sizeof(cfhandle_t); */
- i = sizeof(__u32) * 4; /* ssidev,size,type,ino */
+#ifdef CFS_EXPORT_OPS
+ i = CFS_FH_LEN(fhp);
+#else
+ i = sizeof(cfhandle_t);
+#endif
fhsum = 0;
while (i-- > 0)
fhsum += *fhpp++;
@@ -242,22 +245,30 @@
*
* SMP: Called with svrcfstok_table_lock locked.
*/
-static struct svrcfstok *
+#ifndef RCU_CFSTOK_TABLE
+static
+#endif
+struct svrcfstok *
hfind(cfhandle_t *fhp)
{
#ifdef RCU_CFSTOK_TABLE
struct svrcfstok *hp = NULL;
struct hlist_node *pos;
int found = 0;
+#ifdef CFS_EXPORT_OPS
+ int fh_size = CFS_FH_LEN(fhp);
+#else
+ int fh_size = sizeof(cfhandle_t);
+#endif
#else
struct svrcfstok *hp;
#endif
int hash = svrhash(fhp);
+
#ifdef RCU_CFSTOK_TABLE
rcu_read_lock();
hlist_for_each_entry_rcu(hp, pos, &svrcfs_hash_table[hash], sct_hlist) {
- if (memcmp((caddr_t)fhp, (caddr_t)&(hp->sct_fh),
- sizeof(__u32)*4)) /* ssidev,size,type,ino */
+ if (memcmp((caddr_t)fhp, (caddr_t)&(hp->sct_fh), fh_size))
continue;
found = hash_hold_and_check(hp);
break;
@@ -347,7 +358,9 @@
int locked = FALSE;
#endif
#endif
+#ifdef NOTYET
object_t obj;
+#endif
int hash;
while (1) {
@@ -396,7 +409,11 @@
#endif /* !RCU_CFSTOK_TABLE */
hash = svrhash(fhp);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&hp->sct_fh, fhp, CFS_FH_LEN(fhp));
+#else
hp->sct_fh = *fhp;
+#endif
hp->sct_flags = 0;
@@ -412,7 +429,7 @@
hp->sct_refcnt = 1;
#endif /* !RCU_CFSTOK_TABLE */
-#ifndef SVRCFS_TOKEN_KMEM_CACHE
+#if __SSI_LOCK_DEBUG || !defined(SVRCFS_TOKEN_KMEM_CACHE)
INIT_LOCK(&hp->sct_tcblock);
#ifdef SSI_CFS_FULLTIMES
INIT_LOCK(&hp->sct_atlock);
@@ -428,20 +445,30 @@
/* Initialize all tcbs */
/* Protected by CFS_NOTREADY psuedo lock */
+#ifdef NOTYET
obj.word1 = (long)hp;
obj.obj_pp = &svrparam;
obj.word2 = CFSTOK_MHOLD;
mhsvrtok_init(&obj, &(hp->sct_mhold));
+#else
+ mhsvrtok_init(NULL, &(hp->sct_mhold));
+#endif
for (i = 1 ; i < CFSTOK_NTOKS + 1; i++) {
+#ifdef NOTYET
obj.word2 = i;
+#endif
#ifdef CFSTOK_RANGE
if (BITVAL(i) & CFSTOK_RANGE)
svrtok_init_range(&obj, SCTTORTCB(hp, i));
else
#endif
+#ifdef NOTYET
svrtok_init(&obj, SCTTOTCB(hp, i));
+#else
+ svrtok_init(NULL, SCTTOTCB(hp, i));
+#endif
}
/* Currently no outstanding tokens. Caller better
@@ -605,8 +632,10 @@
{
#ifdef RCU_CFSTOK_TABLE
might_sleep_if(atomic_read(&hp->sct_refcnt) == 1);
- if (!atomic_dec_and_lock(&hp->sct_refcnt, &svrcfstok_table_lock))
+ if (!atomic_dec_and_lock(&hp->sct_refcnt, &svrcfstok_table_lock)) {
+ WARN_ON(atomic_read(&hp->sct_refcnt) < 0);
return;
+ }
LOCK_COND_LOCK(&hp->sct_statelock);
if (atomic_read(&hp->sct_refcnt)) {
UNLOCK_COND_LOCK(&hp->sct_statelock);
@@ -622,7 +651,6 @@
spin_unlock(&svrcfstok_table_lock);
WARN_ON(hp->sct_tokmask);
- BUG_ON(atomic_read(&hp->sct_refcnt));
svrtok_dorelse(hp, FALSE);
#else
LOCK_LOCK(&svrcfstok_table_lock);
@@ -704,7 +732,11 @@
{
struct cfstokargs args;
+#ifdef CFS_EXPORT_OPS
+ memcpy(&args.cta_fhandle, fhp, CFS_FH_LEN(fhp));
+#else
args.cta_fhandle = *fhp;
+#endif
args.cta_type = type;
args.cta_op = op;
args.cta_oldmode = oldmode;
@@ -1046,7 +1078,11 @@
HASH_RELE(hp);
return 0;
}
+#ifdef CFS_EXPORT_OPS
+ memcpy(&ctargs.cta_fhandle, fhp, CFS_FH_LEN(fhp));
+#else
ctargs.cta_fhandle = *fhp;
+#endif
ctargs.cta_agent = agent;
ctargs.cta_op = op;
ctargs.cta_type = type;
@@ -1510,7 +1546,6 @@
#else
LOCK_SPIN_LOCK(&hlist_t_free_lock);
item->hl_next = hlist_t_free;
- mb();
hlist_t_free = item;
hlist_t_free_count++;
UNLOCK_SPIN_LOCK(&hlist_t_free_lock);
@@ -1567,7 +1602,7 @@
hlist_t *item, *tmp;
list_for_each_entry_safe(item, tmp, hlistp, hl_list) {
- list_del(&item->hl_list);
+ list_del_init(&item->hl_list);
#endif /* SVRHOLD_LIST_LINUX_LIST */
SSI_ASSERT(item->hl_op == INSTALL);
/* The new token layer can do install undo's by using
@@ -1611,7 +1646,7 @@
SSI_ASSERT(*tokspp);
list_for_each_entry_safe(item, tmp, hlistp, hl_list) {
- list_del(&item->hl_list);
+ list_del_init(&item->hl_list);
(*tokspp)[i] = item->hl_tok;
hlist_free(item);
i++;
@@ -1684,7 +1719,11 @@
SSI_ASSERT(op == REVOKE || op == QUERY || op == INSTALL);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&ctargs.cta_fhandle, fhp, CFS_FH_LEN(fhp));
+#else
ctargs.cta_fhandle = *fhp;
+#endif
ctargs.cta_agent = agent;
switch(op) {
case REVOKE:
@@ -1762,11 +1801,23 @@
register struct super_block *sb;
struct inode *ip;
unsigned long ino = ((__u32 *)fhp)[3];
+#ifdef CFS_EXPORT_OPS
+ struct cfs_find_desc desc;
+ struct cfsdirok cdrok;
+#endif
sb = ssi_get_super(((__u32 *)fhp)[0]);
if (sb == NULL)
return NULL;
+#ifdef CFS_EXPORT_OPS
+ desc.cdrok = &cdrok;
+ desc.cdrok->cdrok_attr.cna_ino = ino;
+ memcpy(&desc.cdrok->cdrok_fhandle, fhp, CFS_FH_LEN(fhp));
+
+ ip = ilookup5(sb, ino, cfs_find_actor, &desc);
+#else
ip = ilookup(sb, ino);
+#endif
/* Release sb reference */
drop_super(sb);
return ip;
@@ -2161,7 +2212,11 @@
SSI_ASSERT(server != (clusternode_t)this_node);
+#ifdef CFS_EXPORT_OPS
+ memcpy(&ctargs.cta_fhandle, fhp, CFS_FH_LEN(fhp));
+#else
ctargs.cta_fhandle = *fhp;
+#endif
ctargs.cta_agent = this_node;
/* No hints bits since this node doesn't even have a inode */
#ifdef SSI_CFS_POLICY
@@ -2887,8 +2942,8 @@
down(&(dird->d_inode->i_sem));
rdentry = lookup_one_len(name, dird, strlen(name));
if (IS_ERR(rdentry)) {
- error = PTR_ERR(rdentry);
up(&(dird->d_inode->i_sem));
+ error = PTR_ERR(rdentry);
kfree(name);
dput(dird);
goto skip;
@@ -2930,6 +2985,7 @@
#ifdef __KERNEL__
/* Must do this before iput/dput below, because they weren't held */
+ /* As of SSI-1.9.6 they are held */
if (hp->sct_fp != NULL) {
fput(hp->sct_fp);
#ifdef SVRCFS_TOKEN_KMEM_CACHE
@@ -2937,11 +2993,16 @@
#endif
}
+#ifdef SSI_CFS_SKIP
if (hp->sct_dp != NULL) {
+ /* SSI: base will shrink unused child entries */
if (hp->sct_dp->d_flags & DCACHE_DISCONNECTED)
shrink_dcache_parent(hp->sct_dp);
dput(hp->sct_dp);
}
+#else
+ dput(hp->sct_dp);
+#endif
if (hp->sct_ip != NULL) {
#ifdef SSI_CFS_ATIME
@@ -2958,7 +3019,7 @@
}
#endif /* __KERNEL__ */
-#ifndef SVRCFS_TOKEN_KMEM_CACHE
+#if __SSI_LOCK_DEBUG || !defined(SVRCFS_TOKEN_KMEM_CACHE)
DEINIT_LOCK(&hp->sct_tcblock);
#ifdef SSI_CFS_FULLTIMES
DEINIT_LOCK(&hp->sct_atlock);
@@ -2967,7 +3028,7 @@
DEINIT_COND_LOCK(&hp->sct_statelock);
DEINIT_CONDITION(&hp->sct_cond);
DEINIT_RW_LOCK(&hp->sct_objlock);
-#endif /* !SVRCFS_TOKEN_KMEM_CACHE */
+#endif
#ifdef SSI_CFS_SKIP
/* Track active svrcfstok structures per SB: decrement the counter
Index: cfs_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfs_subr.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cfs_subr.c 19 Feb 2009 08:01:01 -0000 1.25
+++ cfs_subr.c 24 Mar 2009 04:26:28 -0000 1.26
@@ -1005,6 +1005,10 @@
/* Get special file system mount semantics */
if (mount_flags & MS_CHARD)
mi_flags |= MI_CHARD;
+#ifdef CFS_INTR
+ else
+ mi_flags |= MI_INTR;
+#endif
#ifdef SKIP
if (mount_flags & MS_NOATTRCACHE)
mi_flags |= MI_NOATTRCACHE;
@@ -1032,7 +1036,7 @@
#endif
{
int error = 0; /* Error code. */
- cfs_mntinfo_t *mip = NULL; /* Pointer to allocated SB info. */
+ cfs_mntinfo_t *mip; /* Pointer to allocated SB info. */
SSI_ASSERT(sb != NULL);
SSI_ASSERT(sb->s_fs_info == NULL);
@@ -1057,7 +1061,7 @@
#ifdef SSI_CFS_SKIP
INIT_ATOMIC_INT(&mip->mi_svrcfstoks, 0);
#endif
-#ifdef SSI_XXX_NOTUSED
+#ifdef SSI_NOTUSED
INIT_LIST_HEAD(&mip->lru_read);
INIT_LIST_HEAD(&mip->lru_dirty);
INIT_LIST_HEAD(&mip->lru_commit);
@@ -1065,10 +1069,20 @@
#endif
INIT_LIST_HEAD(&mip->dirty_down);
INIT_LIST_HEAD(&mip->read_down);
+#ifdef KERNEL2616_53
+ mip->rsize = CFS_MAX_FILE_IO_SIZE;
+ mip->rpages = (mip->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ mip->wsize = CFS_MAX_FILE_IO_SIZE;
+ mip->wpages = (mip->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+#else
mip->rpages = CFS_READ_MAXIOV;
mip->rsize = mip->rpages << PAGE_CACHE_SHIFT;
mip->wpages = CFS_WRITE_MAXIOV;
mip->wsize = mip->wpages << PAGE_CACHE_SHIFT;
+#endif
+#ifdef CFS_BDI
+ mip->backing_dev_info.ra_pages = mip->rpages * CFS_MAX_READAHEAD;
+#endif
#if defined(CFS_ZAP_CACHES) && defined(CFS_FILE_RW_NOLOCK)
#ifdef SKIP
if (sb->s_flags & MS_NOATTRCACHE) {
@@ -1598,66 +1612,71 @@
}
#ifdef CFS_FH_TO_DENTRY_ANON
+struct dentry *
+__cfs_get_dentry(struct super_block *sb, cfhandle_t *fhp)
+{
+#ifdef CFS_EXPORT_OPS
+ struct super_block *psb = sbtocmi(sb)->mi_pfs_sb;
+ struct export_operations *nop = (psb->s_export_op) ? : &export_op_default;
+ int len = ((__u32 *)fhp)[1];
+ int type = ((__u32 *)fhp)[2];
+ __u32 *data = ((__u32 *)fhp) + 4; /* skip ssidev, size, type, ino */
+
+ return CALL(nop,decode_fh)(psb, data, len, type, cfsd_acceptable, NULL);
+#else
+ /*
+ * Attempt to find the inode.
+ */
+ struct dentry *dentry;
+ struct inode *inode;
+ unsigned long ino = ((__u32 *)fhp)[3];
+#ifdef SKIP
+ __u32 generation = ((__u32 *)fhp)[4];
+#endif
+
+ /* SSI_XXX: iget() depreciated on some PFS */
+ inode = iget(sbtocmi(sb)->mi_pfs_sb, ino);
+ if (!inode)
+ return ERR_PTR(-ENOMEM);
+
+#ifdef SKIP
+ /* NB: this test not present in SSI-1.9.0 implementation */
+ if (generation && inode->i_generation != generation)
+ return ERR_PTR(-ESTALE);
+#endif
+
+ /* now to find a dentry.
+ * If possible, get a well-connected one
+ */
+ dentry = d_alloc_anon(inode);
+ if (!dentry)
+ return ERR_PTR(-ENOMEM);
+ return dentry;
+#endif /* !CFS_EXPORT_OPS */
+}
+
/* Do like NFS server really does and get an inode/dentry
* for hooking into svrcfstok.
*/
struct svrcfstok *
cfs_fhtohp(cfhandle_t *fhp)
{
- dev_t ssidev = ((__u32 *)fhp)[0];
struct super_block *sb;
struct dentry *dentry;
struct svrcfstok *hp;
- sb = ssi_get_super(ssidev);
+ sb = ssi_get_super(((__u32 *)fhp)[0]);
if (!sb)
return ERR_PTR(-ESTALE);
-#ifdef CFS_EXPORT_OPS
- /* To become cfsd_decode_fh */
- {
- struct super_block *psb = sbtocmi(sb)->mi_pfs_sb;
- struct export_operations *nop = (psb->s_export_op) ? : &export_op_default;
- int len = ((__u32 *)fhp)[1];
- int type = ((__u32 *)fhp)[2];
- __u32 *data = (__u32 *)fhp;
-
- /* skip ssidev, size, type, ino */
- dentry = CALL(nop,decode_fh)(psb, data+4, len, type,
- cfsd_acceptable, NULL);
- if (IS_ERR(dentry))
- return (struct svrcfstok *) dentry;
- }
-#else
- /*
- * Attempt to find the inode.
- */
- {
- struct inode *inode;
- unsigned long ino = ((__u32 *)fhp)[3];
- __u32 generation = ((__u32 *)fhp)[4];
-
- /* SSI_XXX: iget() depreciated on some PFS */
- inode = iget(sbtocmi(sb)->mi_pfs_sb, ino);
- if (!inode)
- return ERR_PTR(-ENOMEM);
-
- if (generation && inode->i_generation != generation)
- return ERR_PTR(-ESTALE);
-
- /* now to find a dentry.
- * If possible, get a well-connected one
- */
- dentry = d_alloc_anon(inode);
- if (!dentry)
- return ERR_PTR(-ENOMEM);
- }
-#endif
+ dentry = __cfs_get_dentry(sb, fhp);
+ if (!IS_ERR(dentry)) {
+ hp = svrtok_lookup(fhp, dentry, sb);
+ dput(dentry);
+ } else
+ hp = ERR_PTR(-ESTALE);
- hp = makehp(sb, ssidev, dentry);
- dput(dentry);
drop_super(sb);
-
- return hp ? : ERR_PTR(-ESTALE);
+ return hp;
}
-#endif
+#endif /* CFS_FH_TO_DENTRY_ANON */
Index: vfs.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/vfs.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- vfs.c 19 Feb 2009 08:01:01 -0000 1.30
+++ vfs.c 24 Mar 2009 04:26:28 -0000 1.31
@@ -2071,12 +2071,11 @@
{
int ret;
int len = (sizeof(void *) + sizeof(u_int)) * 2 + 1;
- *name = (char *)kmalloc(len, GFP_KERNEL);
+ *name = (char *)kzmalloc(len, GFP_KERNEL);
if (!*name)
return -ENOMEM;
- SSI_ASSERT((sizeof(ip->i_ino) + sizeof(ip->i_generation)) * 2 + 1 ==
- len);
+ /* SSI_ASSERT((sizeof(ip->i_ino) + sizeof(ip->i_generation)) * 2 + 1 == len); */
/* SSI_XXX: This should use dentry_to_fh if available */
ret = snprintf(*name, len, "%p%8.8x",
(void *)ip->i_ino, (u_int)ip->i_generation);
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com