Messages in this thread Patch in this message | | | Date | Mon, 31 Aug 1998 17:52:17 -0400 (EDT) | From | "Peter J. Braam" <> | Subject | [PATCH] Coda |
| |
Hi Linus,
This is a tiny patch for a Coda bug. Shouldn't affect anything else.
The kernel now correctly replaces the Coda Fid's in the coda_inode_info section of the kernel inodes. This is important upon reintegrating changes when a client becomes connected.
Thanks!
- Peter -
--- linux/fs/coda/cnode.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/cnode.c Mon Aug 31 14:02:07 1998 @@ -14,7 +14,6 @@ extern int coda_print_entry; /* cnode.c */ - static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr) { CDEBUG(D_SUPER, "ino: %ld\n", inode->i_ino); @@ -117,7 +116,6 @@ return 0; } - inline int coda_fideq(ViceFid *fid1, ViceFid *fid2) { int eq; @@ -126,6 +124,27 @@ (fid1->Unique == fid2->Unique) ); return eq; } + +void coda_replace_fid(struct inode *inode, struct ViceFid *oldfid, + struct ViceFid *newfid) +{ + struct coda_inode_info *cnp; + struct coda_sb_info *sbi= coda_sbp(inode->i_sb); + + cnp = ITOC(inode); + + if ( ! coda_fideq(&cnp->c_fid, oldfid) ) + printk("What? oldfid != cnp->c_fid. Call 911.\n"); + + cnp->c_fid = *newfid; + + list_del(&cnp->c_volrootlist); + if ( !coda_fid_is_weird(newfid) ) + list_add(&cnp->c_volrootlist, &sbi->sbi_volroothead); + + return; +} + --- linux/fs/coda/dir.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/dir.c Mon Aug 31 14:02:07 1998 @@ -96,7 +96,7 @@ NULL, /* ioctl */ NULL, /* mmap */ coda_open, /* open */ - NULL, /* flush */ + NULL, coda_release, /* release */ coda_fsync, /* fsync */ NULL, --- linux/fs/coda/file.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/file.c Mon Aug 31 14:02:07 1998 @@ -66,7 +66,7 @@ NULL, /* ioctl */ coda_file_mmap, /* mmap */ coda_open, /* open */ - NULL, /* flush */ + NULL, coda_release, /* release */ coda_fsync, /* fsync */ NULL, /* fasync */ --- linux/fs/coda/pioctl.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/pioctl.c Mon Aug 31 14:02:07 1998 @@ -65,7 +65,7 @@ coda_pioctl, /* ioctl */ NULL, /* mmap */ coda_ioctl_open, /* open */ - NULL, /* flush */ + NULL, coda_ioctl_release, /* release */ NULL, /* fsync */ }; --- linux/fs/coda/psdev.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/psdev.c Mon Aug 31 14:02:07 1998 @@ -33,7 +33,6 @@ #include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/poll.h> -#include <linux/init.h> #include <asm/io.h> #include <asm/segment.h> #include <asm/system.h> @@ -47,14 +46,6 @@ #include <linux/coda_cache.h> #include <linux/coda_proc.h> - -/* - * Where is the prototype? - */ - -int proc_register_dynamic(struct proc_dir_entry * dir, - struct proc_dir_entry * dp); - /* * Coda stuff */ @@ -391,7 +382,7 @@ NULL, /* ioctl */ NULL, /* coda_psdev_mmap */ coda_psdev_open, /* open */ - NULL, /* flush */ + NULL, coda_psdev_release, /* release */ NULL, /* fsync */ NULL, /* fasync */ @@ -403,7 +394,15 @@ #ifdef CONFIG_PROC_FS -extern struct proc_dir_entry proc_sys_root; +struct proc_dir_entry proc_sys_root = { + PROC_SYS, 3, "sys", /* inode, name */ + S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, /* mode, nlink, uid, gid */ + 0, &proc_dir_inode_operations, /* size, ops */ + NULL, NULL, /* get_info, fill_inode */ + NULL, /* next */ + NULL, NULL /* parent, subdir */ +}; + struct proc_dir_entry proc_sys_coda = { 0, 4, "coda", @@ -490,6 +489,7 @@ #endif + __initfunc(int init_coda(void)) { int status; @@ -547,14 +547,12 @@ #ifdef MODULE -EXPORT_NO_SYMBOLS; - MODULE_AUTHOR("Peter J. Braam <braam@cs.cmu.edu>"); int init_module(void) { int status; - printk(KERN_INFO "Coda Kernel/Venus communications (module), v4.6.0, braam@cs.cmu.edu\n"); + printk(KERN_INFO "Coda Kernel/Venus communications (module), v4.7.1, braam@cs.cmu.edu.\n"); status = init_coda_psdev(); if ( status ) { --- linux/fs/coda/stats.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/stats.c Mon Aug 31 14:02:07 1998 @@ -7,6 +7,7 @@ * */ +#include <linux/config.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/sysctl.h> --- linux/fs/coda/upcall.c.orig Mon Aug 31 14:02:07 1998 +++ linux/fs/coda/upcall.c Mon Aug 31 14:02:07 1998 @@ -39,8 +39,6 @@ #include <linux/coda_cache.h> #include <linux/coda_proc.h> -extern void coda_purge_dentries(struct inode *inode); -extern void coda_purge_children(struct inode *inode); static int coda_upcall(struct coda_sb_info *mntinfo, int inSize, int *outSize, union inputArgs *buffer); @@ -537,16 +535,12 @@ inp->cfs_ioctl.data = (char *)(INSIZE(ioctl)); /* get the data out of user space */ -#ifdef L20 - memcpy_fromfs((char*)inp + (int)inp->cfs_ioctl.data, - data->vi.in, data->vi.in_size); -#else if ( copy_from_user((char*)inp + (int)inp->cfs_ioctl.data, data->vi.in, data->vi.in_size) ) { error = EINVAL; goto exit; } -#endif + error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); if (error) { @@ -565,18 +559,13 @@ error = verify_area(VERIFY_WRITE, data->vi.out, data->vi.out_size); if ( error ) goto exit; -#ifdef L20 - memcpy_tofs(data->vi.out, - (char *)outp + (int)outp->cfs_ioctl.data, - data->vi.out_size); -#else + if (copy_to_user(data->vi.out, (char *)outp + (int)outp->cfs_ioctl.data, data->vi.out_size)) { error = EINVAL; goto exit; } -#endif } exit: @@ -891,18 +880,20 @@ case CFS_REPLACE : { struct inode *inode; - ViceFid *fid = &out->cfs_replace.OldFid; + ViceFid *oldfid = &out->cfs_replace.OldFid; + ViceFid *newfid = &out->cfs_replace.NewFid; clstats(CFS_REPLACE); CDEBUG(D_DOWNCALL, "CFS_REPLACE\n"); - inode = coda_fid_to_inode(fid, sb); + inode = coda_fid_to_inode(newfid, sb); if ( inode ) { CDEBUG(D_DOWNCALL, "replacefid: inode = %ld\n", inode->i_ino); - coda_purge_children(inode); + coda_replace_fid(inode, oldfid, newfid); coda_purge_dentries(inode); }else CDEBUG(D_DOWNCALL, "purgefid: no inode\n"); + return 0; - } + } } return 0; } --- linux/include/linux/coda.h.orig Mon Aug 31 14:02:07 1998 +++ linux/include/linux/coda.h Mon Aug 31 14:02:07 1998 @@ -72,6 +72,7 @@ #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 +#define C_O_CREAT 0x200 /* these are to find mode bits in Venus */ #define C_M_READ 00400 @@ -80,6 +81,7 @@ /* for access Venus will use */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ +#define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_X_OK 1 /* Test for execute permission. */ #define C_A_F_OK 0 /* Test for existence. */ @@ -148,8 +150,8 @@ #ifndef _VUID_T_ #define _VUID_T_ -typedef unsigned int vuid_t; -typedef unsigned int vgid_t; +typedef u_int32_t vuid_t; +typedef u_int32_t vgid_t; #endif /*_VUID_T_ */ #ifndef _CODACRED_T_ --- linux/include/linux/coda_fs_i.h.orig Mon Aug 31 14:02:07 1998 +++ linux/include/linux/coda_fs_i.h Mon Aug 31 14:02:07 1998 @@ -43,7 +43,7 @@ int coda_cnode_make(struct inode **, struct ViceFid *, struct super_block *); int coda_cnode_makectl(struct inode **inode, struct super_block *sb); struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb); - +void coda_replace_fid(struct inode *, ViceFid *, ViceFid *); #endif #endif --- linux/include/linux/coda_linux.h.orig Mon Aug 31 14:02:07 1998 +++ linux/include/linux/coda_linux.h Mon Aug 31 14:02:07 1998 @@ -51,7 +51,6 @@ int coda_fid_is_weird(struct ViceFid *fid); int coda_iscontrol(const char *name, size_t length); - void coda_load_creds(struct coda_cred *cred); int coda_mycred(struct coda_cred *); void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); @@ -70,6 +69,11 @@ int coda_inode_grab(dev_t dev, ino_t ino, struct inode **ind); #define NB_SFS_SIZ 0x895440 + +/* cache.c */ +void coda_purge_children(struct inode *); +void coda_purge_dentries(struct inode *); + /* debugging masks */ #define D_SUPER 1 /* print results returned by Venus */
| |