Commit 253112b4 authored by Chen Yang's avatar Chen Yang Committed by Anton Altaparmakov

[PATCH] Make intermezzo work again

 - Chen Yang's fix to work with NGROUPS
 - Chen Yang's fix to handle file deletion
 - Remove TCGETS handling and return  -ENOTTY for unknown ioctl code.
 - Removed InterMezzo from BROKEN state
parent 9cb5a22b
......@@ -1587,7 +1587,7 @@ config CODA_FS_OLD_API
#
config INTERMEZZO_FS
tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)"
depends on INET && EXPERIMENTAL && BROKEN
depends on INET && EXPERIMENTAL
help
InterMezzo is a networked file system with disconnected operation
and kernel level write back caching. It is most often used for
......
......@@ -1300,13 +1300,9 @@ int presto_ioctl(struct inode *inode, struct file *file,
return rc;
}
case TCGETS:
EXIT;
return -EINVAL;
default:
EXIT;
return -EINVAL;
return -ENOTTY;
}
EXIT;
......
......@@ -217,9 +217,9 @@ static int presto_file_open(struct inode *inode, struct file *file)
fdata->fd_mode = file->f_dentry->d_inode->i_mode;
fdata->fd_uid = file->f_dentry->d_inode->i_uid;
fdata->fd_gid = file->f_dentry->d_inode->i_gid;
fdata->fd_ngroups = current->ngroups;
for (i=0 ; i < current->ngroups ; i++)
fdata->fd_groups[i] = current->groups[i];
fdata->fd_ngroups = current->group_info->ngroups;
for (i=0 ; i < current->group_info->ngroups ; i++)
fdata->fd_groups[i] = GROUP_AT(current->group_info,i);
if (!ISLENTO(minor))
fdata->fd_info.flags = LENTO_FL_KML;
else {
......
......@@ -418,7 +418,7 @@ static void izo_setup_ctxt(struct dentry *root, struct vfsmount *mnt,
new.fsgid = 0;
new.fs = get_fs();
/* XXX where can we get the groups from? */
new.ngroups = 0;
new.group_info = groups_alloc(0);
push_ctxt(save, &new);
}
......
......@@ -152,14 +152,14 @@ struct run_ctxt {
uid_t fsuid;
gid_t fsgid;
mm_segment_t fs;
int ngroups;
gid_t groups[NGROUPS];
struct group_info * group_info;
/* int ngroups;
gid_t groups[NGROUPS];*/
};
static inline void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
{
int i;
save->fs = get_fs();
save->pwd = dget(current->fs->pwd);
save->pwdmnt = mntget(current->fs->pwdmnt);
......@@ -167,9 +167,10 @@ static inline void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
save->fsuid = current->fsuid;
save->root = current->fs->root;
save->rootmnt = current->fs->rootmnt;
save->ngroups = current->ngroups;
save->group_info = current->group_info;
/* save->ngroups = current->ngroups;
for (i = 0; i< current->ngroups; i++)
save->groups[i] = current->groups[i];
save->groups[i] = current->groups[i];*/
set_fs(new->fs);
lock_kernel();
......@@ -179,18 +180,17 @@ static inline void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
unlock_kernel();
current->fsuid = new->fsuid;
current->fsgid = new->fsgid;
if (new->ngroups > 0) {
/*if (new->ngroups > 0) {
current->ngroups = new->ngroups;
for (i = 0; i< new->ngroups; i++)
current->groups[i] = new->groups[i];
}
}*/
current->group_info = new->group_info;
}
static inline void pop_ctxt(struct run_ctxt *saved)
{
int i;
set_fs(saved->fs);
lock_kernel();
set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
......@@ -199,10 +199,12 @@ static inline void pop_ctxt(struct run_ctxt *saved)
unlock_kernel();
current->fsuid = saved->fsuid;
current->fsgid = saved->fsgid;
current->group_info = saved->group_info;
/*
current->ngroups = saved->ngroups;
for (i = 0; i< saved->ngroups; i++)
current->groups[i] = saved->groups[i];
*/
mntput(saved->pwdmnt);
dput(saved->pwd);
}
......@@ -392,7 +394,7 @@ struct presto_file_data {
uid_t fd_fsuid;
gid_t fd_fsgid;
int fd_ngroups;
gid_t fd_groups[NGROUPS_MAX];
gid_t fd_groups[NGROUPS_SMALL];
/* information how to complete the close operation */
struct lento_vfs_context fd_info;
struct presto_version fd_version;
......
......@@ -41,7 +41,7 @@ struct big_journal_prefix {
u32 fsgid;
u32 opcode;
u32 ngroups;
u32 groups[NGROUPS_MAX];
u32 groups[NGROUPS_SMALL];
};
enum kml_opcode {
......
......@@ -309,7 +309,7 @@ journal_log_prefix_with_groups_and_ids(char *buf, int opcode,
__u32 fsuid, __u32 fsgid)
{
struct kml_prefix_hdr p;
u32 loggroups[NGROUPS_MAX];
u32 loggroups[NGROUPS_SMALL];
int i;
......@@ -332,15 +332,15 @@ journal_log_prefix_with_groups_and_ids(char *buf, int opcode,
static inline char *
journal_log_prefix(char *buf, int opcode, struct rec_info *rec)
{
__u32 groups[NGROUPS_MAX];
__u32 groups[NGROUPS_SMALL];
int i;
/* convert 16 bit gid's to 32 bit gid's */
for (i=0; i<current->ngroups; i++)
groups[i] = (__u32) current->groups[i];
for (i=0; i<current->group_info->ngroups; i++)
groups[i] = GROUP_AT(current->group_info,i);
return journal_log_prefix_with_groups_and_ids(buf, opcode, rec,
(__u32)current->ngroups,
(__u32)current->group_info->ngroups,
groups,
(__u32)current->fsuid,
(__u32)current->fsgid);
......@@ -1319,7 +1319,7 @@ int presto_write_lml_close(struct rec_info *rec,
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
ino = cpu_to_le64(dentry->d_inode->i_ino);
generation = cpu_to_le32(dentry->d_inode->i_generation);
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + sizeof(*new_file_ver) +
sizeof(ino) + sizeof(generation) + sizeof(pathlen) +
sizeof(remote_ino) + sizeof(remote_generation) +
......@@ -1529,7 +1529,7 @@ int presto_journal_setattr(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + sizeof(*old_ver) +
sizeof(valid) + sizeof(mode) + sizeof(uid) + sizeof(gid) +
sizeof(fsize) + sizeof(mtime) + sizeof(ctime) + sizeof(flags) +
......@@ -1600,7 +1600,7 @@ int presto_get_fileid(int minor, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + sizeof(pathlen) +
size_round(le32_to_cpu(pathlen)) +
sizeof(struct kml_suffix);
......@@ -1659,7 +1659,7 @@ int presto_journal_create(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
sizeof(struct kml_suffix);
......@@ -1715,7 +1715,7 @@ int presto_journal_symlink(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
sizeof(targetlen) + sizeof(struct kml_suffix);
......@@ -1773,7 +1773,7 @@ int presto_journal_mkdir(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
sizeof(struct kml_suffix);
......@@ -1828,7 +1828,7 @@ presto_journal_rmdir(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dir, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
sizeof(struct kml_suffix);
......@@ -1891,7 +1891,7 @@ presto_journal_mknod(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dentry, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(lmajor) +
sizeof(lminor) + sizeof(pathlen) +
......@@ -1951,7 +1951,7 @@ presto_journal_link(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, srcbuffer);
path = presto_path(tgt, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(srcpathlen) + sizeof(pathlen) +
sizeof(struct kml_suffix);
......@@ -2009,7 +2009,7 @@ int presto_journal_rename(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, srcbuffer);
path = presto_path(tgt, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 4 * sizeof(*src_dir_ver) +
sizeof(srcpathlen) + sizeof(pathlen) +
sizeof(struct kml_suffix);
......@@ -2069,7 +2069,7 @@ int presto_journal_unlink(struct rec_info *rec, struct presto_file_set *fset,
BUFF_ALLOC(buffer, NULL);
path = presto_path(dir, root, buffer, PAGE_SIZE);
pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
sizeof(old_targetlen) + sizeof(struct kml_suffix);
......@@ -2116,7 +2116,7 @@ presto_journal_close(struct rec_info *rec, struct presto_file_set *fset,
__u32 open_fsuid;
__u32 open_fsgid;
__u32 open_ngroups;
__u32 open_groups[NGROUPS_MAX];
__u32 open_groups[NGROUPS_SMALL];
__u32 open_mode;
__u32 open_uid;
__u32 open_gid;
......@@ -2146,9 +2146,9 @@ presto_journal_close(struct rec_info *rec, struct presto_file_set *fset,
open_fsuid = fd->fd_fsuid;
open_fsgid = fd->fd_fsgid;
} else {
open_ngroups = current->ngroups;
for (i=0; i<current->ngroups; i++)
open_groups[i] = (__u32) current->groups[i];
open_ngroups = current->group_info->ngroups;
for (i=0; i<current->group_info->ngroups; i++)
open_groups[i] = (__u32) GROUP_AT(current->group_info,i);
open_mode = dentry->d_inode->i_mode;
open_uid = dentry->d_inode->i_uid;
open_gid = dentry->d_inode->i_gid;
......@@ -2246,7 +2246,7 @@ int presto_rewrite_close(struct rec_info *rec, struct presto_file_set *fset,
/* write closes for the local close records in the LML */
int presto_complete_lml(struct presto_file_set *fset)
{
__u32 groups[NGROUPS_MAX];
__u32 groups[NGROUPS_SMALL];
loff_t lml_offset;
loff_t read_offset;
char *buffer;
......@@ -2408,7 +2408,7 @@ int presto_journal_set_ext_attr (struct rec_info *rec,
*/
mode=cpu_to_le32(dentry->d_inode->i_mode);
size = sizeof(__u32) * current->ngroups +
size = sizeof(__u32) * current->group_info->ngroups +
sizeof(struct kml_prefix_hdr) +
2 * sizeof(struct presto_version) +
sizeof(flags) + sizeof(mode) + sizeof(namelen) +
......
......@@ -53,11 +53,11 @@ static void kmlreint_pre_secure(struct kml_rec *rec, struct file *dir,
ctxt.root = ctxt.pwd;
ctxt.rootmnt = ctxt.pwdmnt;
if (rec->prefix.hdr->ngroups > 0) {
ctxt.ngroups = rec->prefix.hdr->ngroups;
for (i = 0; i< ctxt.ngroups; i++)
ctxt.groups[i] = rec->prefix.groups[i];
ctxt.group_info = groups_alloc(rec->prefix.hdr->ngroups);
for (i = 0; i< ctxt.group_info->ngroups; i++)
GROUP_AT(ctxt.group_info,i)= rec->prefix.groups[i];
} else
ctxt.ngroups = 0;
ctxt.group_info = groups_alloc(0);
push_ctxt(saved, &ctxt);
}
......
......@@ -965,8 +965,6 @@ int presto_do_unlink(struct presto_file_set *fset, struct dentry *dir,
do_rcvd = presto_do_rcvd(info, dir);
error = iops->unlink(dir->d_inode, dentry);
unlock_kernel();
if (!error)
d_delete(dentry);
}
if (linkno > 1) {
......@@ -988,10 +986,6 @@ int presto_do_unlink(struct presto_file_set *fset, struct dentry *dir,
}
// up(&dir->d_inode->i_zombie);
if (error) {
EXIT;
goto exit;
}
presto_debug_fail_blkdev(fset, KML_OPCODE_UNLINK | 0x10);
if ( do_kml )
......@@ -1048,6 +1042,8 @@ int lento_unlink(const char *pathname, struct lento_vfs_context *info)
if (nd.last.name[nd.last.len])
goto slashes;
error = presto_do_unlink(fset, nd.dentry, dentry, info);
if (!error)
d_delete(dentry);
exit2:
EXIT;
dput(dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment