summaryrefslogtreecommitdiffstats
path: root/fs/coda
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda')
-rw-r--r--fs/coda/dir.c2
-rw-r--r--fs/coda/file.c4
-rw-r--r--fs/coda/psdev.c41
-rw-r--r--fs/coda/upcall.c6
4 files changed, 15 insertions, 38 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index e949f7986..0e6fa5625 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -55,7 +55,7 @@ static void coda_prepare_fakefile(struct inode *coda_inode,
struct dentry *open_dentry);
static int coda_venus_readdir(struct file *filp, void *dirent,
filldir_t filldir);
-int coda_fsync(struct file *, struct dentry *dentry);
+int coda_fsync(struct file *, struct dentry *dentry, int datasync);
int coda_hasmknod = 0;
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 9aecd716a..128b07d44 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -40,7 +40,7 @@ coda_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
}
/* exported from this file (used for dirs) */
-int coda_fsync(struct file *coda_file, struct dentry *coda_dentry)
+int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
{
struct inode *inode = coda_dentry->d_inode;
struct dentry cont_dentry;
@@ -60,7 +60,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry)
cont_dentry.d_inode = (struct inode *)inode->i_mapping->host;
down(&cont_dentry.d_inode->i_sem);
- result = file_fsync(NULL, &cont_dentry);
+ result = file_fsync(NULL, &cont_dentry, datasync);
up(&cont_dentry.d_inode->i_sem);
if ( result == 0 ) {
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 45025e871..14fe68ad4 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -109,7 +109,7 @@ static ssize_t coda_psdev_write(struct file *file, const char *buf,
ssize_t retval = 0, count = 0;
int error;
- if ( !coda_upc_comm.vc_pid )
+ if ( !coda_upc_comm.vc_inuse )
return -EIO;
/* Peek at the opcode, uniquefier */
if (copy_from_user(&hdr, buf, 2 * sizeof(u_long)))
@@ -291,29 +291,14 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
struct venus_comm *vcp = &coda_upc_comm;
ENTRY;
- /* first opener: must be lento. Initialize & take its pid */
- if ( (file->f_flags & O_ACCMODE) == O_RDWR ) {
- if ( vcp->vc_pid ) {
- printk("Venus pid already set to %d!!\n", vcp->vc_pid);
- return -1;
- }
- if ( vcp->vc_inuse ) {
- printk("psdev_open: Cannot O_RDWR while open.\n");
- return -1;
- }
- }
-
- vcp->vc_inuse++;
-
- if ( (file->f_flags & O_ACCMODE) == O_RDWR ) {
- vcp->vc_pid = current->pid;
- vcp->vc_seq = 0;
- INIT_LIST_HEAD(&vcp->vc_pending);
- INIT_LIST_HEAD(&vcp->vc_processing);
+ /* first opener, initialize */
+ if (!vcp->vc_inuse++) {
+ INIT_LIST_HEAD(&vcp->vc_pending);
+ INIT_LIST_HEAD(&vcp->vc_processing);
+ vcp->vc_seq = 0;
}
- CDEBUG(D_PSDEV, "inuse: %d, vc_pid %d, caller %d\n",
- vcp->vc_inuse, vcp->vc_pid, current->pid);
+ CDEBUG(D_PSDEV, "inuse: %d\n", vcp->vc_inuse);
EXIT;
return 0;
@@ -332,17 +317,9 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
return -1;
}
- vcp->vc_inuse--;
- CDEBUG(D_PSDEV, "inuse: %d, vc_pid %d, caller %d\n",
- vcp->vc_inuse, vcp->vc_pid, current->pid);
-
- if ( vcp->vc_pid != current->pid ) {
- /* FIXME: this is broken. If venus does fork(), accounting goes wrong */
- printk( "Closed by someone else than caller?\n" );
- return 0;
- }
+ CDEBUG(D_PSDEV, "psdev_release: inuse %d\n", vcp->vc_inuse);
+ if (--vcp->vc_inuse) return 0;
- vcp->vc_pid = 0;
/* Wakeup clients so they can return. */
CDEBUG(D_PSDEV, "wake up pending clients\n");
lh = vcp->vc_pending.next;
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 674c8cb3b..206c9d8b0 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -625,7 +625,7 @@ static inline unsigned long coda_waitfor_upcall(struct upc_req *vmp)
set_current_state(TASK_UNINTERRUPTIBLE);
/* venus died */
- if ( !coda_upc_comm.vc_pid )
+ if ( !coda_upc_comm.vc_inuse )
break;
/* got a reply */
@@ -688,7 +688,7 @@ static int coda_upcall(struct coda_sb_info *sbi,
ENTRY;
vcommp = &coda_upc_comm;
- if ( !vcommp->vc_pid ) {
+ if ( !vcommp->vc_inuse ) {
printk("No pseudo device in upcall comms at %p\n", vcommp);
return -ENXIO;
}
@@ -733,7 +733,7 @@ ENTRY;
CDEBUG(D_UPCALL,
"..process %d woken up by Venus for req at %p, data at %p\n",
current->pid, req, req->uc_data);
- if (vcommp->vc_pid) { /* i.e. Venus is still alive */
+ if (vcommp->vc_inuse) { /* i.e. Venus is still alive */
/* Op went through, interrupt or not... */
if (req->uc_flags & REQ_WRITE) {
out = (union outputArgs *)req->uc_data;