From 8c3468eda624780004e781256c75d2592ecb993b Mon Sep 17 00:00:00 2001 From: "Stephen D. Smalley" Date: Wed, 15 Jan 2003 22:18:05 -0800 Subject: [PATCH] Add LSM hook to do_kern_mount This patch adds a security_sb_kern_mount hook call to the do_kern_mount function. This hook enables initialization of the superblock security information of all superblock objects. Placing a hook in do_kern_mount was originally suggested by Al Viro. This hook is used by SELinux to setup the superblock security state and eliminated the need for the superblock_precondition function. --- fs/super.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fs') diff --git a/fs/super.c b/fs/super.c index 09e0fa12b126..895bef55bbd7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -610,6 +610,7 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data) struct file_system_type *type = get_fs_type(fstype); struct super_block *sb = ERR_PTR(-ENOMEM); struct vfsmount *mnt; + int error; if (!type) return ERR_PTR(-ENODEV); @@ -620,6 +621,13 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data) sb = type->get_sb(type, flags, name, data); if (IS_ERR(sb)) goto out_mnt; + error = security_sb_kern_mount(sb); + if (error) { + up_write(&sb->s_umount); + deactivate_super(sb); + sb = ERR_PTR(error); + goto out_mnt; + } mnt->mnt_sb = sb; mnt->mnt_root = dget(sb->s_root); mnt->mnt_mountpoint = sb->s_root; -- cgit v1.2.3 From 4f152a7e3158bc6368866d8521333b2f773723e3 Mon Sep 17 00:00:00 2001 From: "Stephen D. Smalley" Date: Wed, 15 Jan 2003 22:23:59 -0800 Subject: [PATCH] Replace inode_post_lookup hook with d_instantiate hook This patch removes the security_inode_post_lookup hook entirely and adds a security_d_instantiate hook call to the d_instantiate function and the d_splice_alias function. The inode_post_lookup hook was subject to races since the inode is already accessible through the dcache before it is called, didn't handle filesystems that directly populate the dcache, and wasn't always called in the desired context (e.g. for pipe, shmem, and devpts inodes). The d_instantiate hook enables initialization of the inode security information. This hook is used by SELinux and by DTE to setup the inode security state, and eliminated the need for the inode_precondition function in SELinux. --- fs/dcache.c | 3 +++ fs/namei.c | 9 +++------ include/linux/security.h | 25 ++++++++++--------------- security/dummy.c | 13 +++++++------ 4 files changed, 23 insertions(+), 27 deletions(-) (limited to 'fs') diff --git a/fs/dcache.c b/fs/dcache.c index 931b475e0186..d4c27c8f6106 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -25,6 +25,7 @@ #include #include #include +#include #define DCACHE_PARANOIA 1 /* #define DCACHE_DEBUG 1 */ @@ -699,6 +700,7 @@ struct dentry * d_alloc(struct dentry * parent, const struct qstr *name) void d_instantiate(struct dentry *entry, struct inode * inode) { if (!list_empty(&entry->d_alias)) BUG(); + security_d_instantiate(entry, inode); spin_lock(&dcache_lock); if (inode) list_add(&entry->d_alias, &inode->i_dentry); @@ -825,6 +827,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) struct dentry *new = NULL; if (inode && S_ISDIR(inode->i_mode)) { + security_d_instantiate(dentry, inode); spin_lock(&dcache_lock); if (!list_empty(&inode->i_dentry)) { new = list_entry(inode->i_dentry.next, struct dentry, d_alias); diff --git a/fs/namei.c b/fs/namei.c index 2dbd2642362c..554ca815f681 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -372,10 +372,8 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, i result = dir->i_op->lookup(dir, dentry); if (result) dput(dentry); - else { + else result = dentry; - security_inode_post_lookup(dir, result); - } } up(&dir->i_sem); return result; @@ -916,10 +914,9 @@ struct dentry * lookup_hash(struct qstr *name, struct dentry * base) if (!new) goto out; dentry = inode->i_op->lookup(inode, new); - if (!dentry) { + if (!dentry) dentry = new; - security_inode_post_lookup(inode, dentry); - } else + else dput(new); } out: diff --git a/include/linux/security.h b/include/linux/security.h index aa1eac77eba4..64d7ede3faaa 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -339,10 +339,6 @@ struct swap_info_struct; * @mnt is the vfsmount where the dentry was looked up * @dentry contains the dentry structure for the file. * Return 0 if permission is granted. - * @inode_post_lookup: - * Set the security attributes for a file after it has been looked up. - * @inode contains the inode structure for parent directory. - * @d contains the dentry structure for the file. * @inode_delete: * @inode contains the inode structure for deleted inode. * This hook is called when a deleted inode is released (i.e. an inode @@ -868,7 +864,6 @@ struct security_operations { int (*inode_permission_lite) (struct inode *inode, int mask); int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); - void (*inode_post_lookup) (struct inode *inode, struct dentry *d); void (*inode_delete) (struct inode *inode); int (*inode_setxattr) (struct dentry *dentry, char *name, void *value, size_t size, int flags); @@ -953,6 +948,8 @@ struct security_operations { struct security_operations *ops); int (*unregister_security) (const char *name, struct security_operations *ops); + + void (*d_instantiate) (struct dentry * dentry, struct inode * inode); }; /* global variables */ @@ -1246,12 +1243,6 @@ static inline int security_inode_getattr (struct vfsmount *mnt, return security_ops->inode_getattr (mnt, dentry); } -static inline void security_inode_post_lookup (struct inode *inode, - struct dentry *dentry) -{ - security_ops->inode_post_lookup (inode, dentry); -} - static inline void security_inode_delete (struct inode *inode) { security_ops->inode_delete (inode); @@ -1549,6 +1540,11 @@ static inline int security_sem_semop (struct sem_array * sma, return security_ops->sem_semop(sma, sops, nsops, alter); } +static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) +{ + security_ops->d_instantiate (dentry, inode); +} + /* prototypes */ extern int security_scaffolding_startup (void); extern int register_security (struct security_operations *ops); @@ -1828,10 +1824,6 @@ static inline int security_inode_getattr (struct vfsmount *mnt, return 0; } -static inline void security_inode_post_lookup (struct inode *inode, - struct dentry *dentry) -{ } - static inline void security_inode_delete (struct inode *inode) { } @@ -2115,6 +2107,9 @@ static inline int security_sem_semop (struct sem_array * sma, return 0; } +static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) +{ } + #endif /* CONFIG_SECURITY */ #endif /* ! __LINUX_SECURITY_H */ diff --git a/security/dummy.c b/security/dummy.c index 629cd8d7464b..8a24e65329d9 100644 --- a/security/dummy.c +++ b/security/dummy.c @@ -311,11 +311,6 @@ static int dummy_inode_getattr (struct vfsmount *mnt, struct dentry *dentry) return 0; } -static void dummy_inode_post_lookup (struct inode *ino, struct dentry *d) -{ - return; -} - static void dummy_inode_delete (struct inode *ino) { return; @@ -612,6 +607,12 @@ static int dummy_unregister_security (const char *name, struct security_operatio return -EINVAL; } +static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode) +{ + return; +} + + struct security_operations dummy_security_ops; #define set_to_dummy_if_null(ops, function) \ @@ -674,7 +675,6 @@ void security_fixup_ops (struct security_operations *ops) set_to_dummy_if_null(ops, inode_permission_lite); set_to_dummy_if_null(ops, inode_setattr); set_to_dummy_if_null(ops, inode_getattr); - set_to_dummy_if_null(ops, inode_post_lookup); set_to_dummy_if_null(ops, inode_delete); set_to_dummy_if_null(ops, inode_setxattr); set_to_dummy_if_null(ops, inode_getxattr); @@ -731,5 +731,6 @@ void security_fixup_ops (struct security_operations *ops) set_to_dummy_if_null(ops, sem_semop); set_to_dummy_if_null(ops, register_security); set_to_dummy_if_null(ops, unregister_security); + set_to_dummy_if_null(ops, d_instantiate); } -- cgit v1.2.3 From 66a675573c7eacf6ef67a43e1cfdab48ff6ecf22 Mon Sep 17 00:00:00 2001 From: "Stephen D. Smalley" Date: Wed, 15 Jan 2003 22:35:24 -0800 Subject: [PATCH] allocate and free security structures for private files This patch adds a security_file_alloc call to init_private_file and creates a close_private_file function to encapsulate the release of private file structures. These changes ensure that security structures for private files will be allocated and freed appropriately. Per Andi Kleen's comments, the patch also renames init_private_file to open_private_file to force updating of all callers, since they will also need to be updated to use close_private_file to avoid a leak of the security structure. Per Christoph Hellwig's comments, the patch also replaces the 'mode' argument with a 'flags' argument, computing the f_mode from the flags, and it explicitly tests f_op prior to dereferencing, as in dentry_open(). --- fs/exportfs/expfs.c | 5 ++--- fs/file_table.c | 35 +++++++++++++++++++++++++++-------- fs/nfsd/vfs.c | 9 +++------ include/linux/fs.h | 5 ++++- kernel/ksyms.c | 3 ++- 5 files changed, 38 insertions(+), 19 deletions(-) (limited to 'fs') diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 9a66fe94dc3f..c74c4a628633 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -353,7 +353,7 @@ static int get_name(struct dentry *dentry, char *name, /* * Open the directory ... */ - error = init_private_file(&file, dentry, FMODE_READ); + error = open_private_file(&file, dentry, O_RDONLY); if (error) goto out; error = -EINVAL; @@ -381,8 +381,7 @@ static int get_name(struct dentry *dentry, char *name, } out_close: - if (file.f_op->release) - file.f_op->release(dir, &file); + close_private_file(&file); out: return error; } diff --git a/fs/file_table.c b/fs/file_table.c index f656300a9d6c..e9333d64c781 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -93,23 +93,42 @@ struct file * get_empty_filp(void) /* * Clear and initialize a (private) struct file for the given dentry, - * and call the open function (if any). The caller must verify that - * inode->i_fop is not NULL. + * allocate the security structure, and call the open function (if any). + * The file should be released using close_private_file. */ -int init_private_file(struct file *filp, struct dentry *dentry, int mode) +int open_private_file(struct file *filp, struct dentry *dentry, int flags) { + int error; memset(filp, 0, sizeof(*filp)); eventpoll_init_file(filp); - filp->f_mode = mode; + filp->f_flags = flags; + filp->f_mode = (flags+1) & O_ACCMODE; atomic_set(&filp->f_count, 1); filp->f_dentry = dentry; filp->f_uid = current->fsuid; filp->f_gid = current->fsgid; filp->f_op = dentry->d_inode->i_fop; - if (filp->f_op->open) - return filp->f_op->open(dentry->d_inode, filp); - else - return 0; + error = security_file_alloc(filp); + if (!error) + if (filp->f_op && filp->f_op->open) { + error = filp->f_op->open(dentry->d_inode, filp); + if (error) + security_file_free(filp); + } + return error; +} + +/* + * Release a private file by calling the release function (if any) and + * freeing the security structure. + */ +void close_private_file(struct file *file) +{ + struct inode * inode = file->f_dentry->d_inode; + + if (file->f_op && file->f_op->release) + file->f_op->release(inode, file); + security_file_free(file); } void fput(struct file * file) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 088ee1438f54..d0d1a132197c 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -426,7 +426,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, { struct dentry *dentry; struct inode *inode; - int flags = O_RDONLY|O_LARGEFILE, mode = FMODE_READ, err; + int flags = O_RDONLY|O_LARGEFILE, err; /* * If we get here, then the client has already done an "open", @@ -463,14 +463,12 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, goto out_nfserr; flags = O_WRONLY|O_LARGEFILE; - mode = FMODE_WRITE; DQUOT_INIT(inode); } - err = init_private_file(filp, dentry, mode); + err = open_private_file(filp, dentry, flags); if (!err) { - filp->f_flags = flags; filp->f_vfsmnt = fhp->fh_export->ex_mnt; } else if (access & MAY_WRITE) put_write_access(inode); @@ -491,8 +489,7 @@ nfsd_close(struct file *filp) struct dentry *dentry = filp->f_dentry; struct inode *inode = dentry->d_inode; - if (filp->f_op->release) - filp->f_op->release(inode, filp); + close_private_file(filp); if (filp->f_mode & FMODE_WRITE) put_write_access(inode); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 595ea1af33fd..d6575f86eb7c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -489,7 +489,10 @@ extern spinlock_t files_lock; #define get_file(x) atomic_inc(&(x)->f_count) #define file_count(x) atomic_read(&(x)->f_count) -extern int init_private_file(struct file *, struct dentry *, int); +/* Initialize and open a private file and allocate its security structure. */ +extern int open_private_file(struct file *, struct dentry *, int); +/* Release a private file and free its security structure. */ +extern void close_private_file(struct file *file); #define MAX_NON_LFS ((1UL<<31) - 1) diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 574addf5af63..a11b98ece511 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -179,7 +179,8 @@ EXPORT_SYMBOL(mark_buffer_dirty); EXPORT_SYMBOL(end_buffer_io_sync); EXPORT_SYMBOL(__mark_inode_dirty); EXPORT_SYMBOL(get_empty_filp); -EXPORT_SYMBOL(init_private_file); +EXPORT_SYMBOL(open_private_file); +EXPORT_SYMBOL(close_private_file); EXPORT_SYMBOL(filp_open); EXPORT_SYMBOL(filp_close); EXPORT_SYMBOL(put_filp); -- cgit v1.2.3 From 555b0a6d6ef94a4ee1633972cead68cf03874af6 Mon Sep 17 00:00:00 2001 From: "Stephen D. Smalley" Date: Sun, 16 Feb 2003 22:32:23 -0800 Subject: [PATCH] LSM: coding style fixups in sb_kern_mount This patch moves the error handling code for the sb_kern_mount hook call out of line, per Christoph Hellwig's suggestion. --- fs/super.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fs') diff --git a/fs/super.c b/fs/super.c index 24e8b30e9b49..239ce4712f39 100644 --- a/fs/super.c +++ b/fs/super.c @@ -623,12 +623,8 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data) if (IS_ERR(sb)) goto out_mnt; error = security_sb_kern_mount(sb); - if (error) { - up_write(&sb->s_umount); - deactivate_super(sb); - sb = ERR_PTR(error); - goto out_mnt; - } + if (error) + goto out_sb; mnt->mnt_sb = sb; mnt->mnt_root = dget(sb->s_root); mnt->mnt_mountpoint = sb->s_root; @@ -636,6 +632,10 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data) up_write(&sb->s_umount); put_filesystem(type); return mnt; +out_sb: + up_write(&sb->s_umount); + deactivate_super(sb); + sb = ERR_PTR(error); out_mnt: free_vfsmnt(mnt); out: -- cgit v1.2.3 From 453a629b6aca9937d71f7438ee91dade4477b743 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 14 Mar 2003 02:11:30 -0800 Subject: [PATCH] kNFSd: Fix exit-without-free bug in nfsd --- fs/nfsd/export.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 03c01534a522..dfb58e34aefa 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -294,7 +294,9 @@ int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) /* client */ len = qword_get(&mesg, buf, PAGE_SIZE); - if (len <= 0) return -EINVAL; + err = -EINVAL; + if (len <= 0) goto out; + err = -ENOENT; dom = auth_domain_find(buf); if (!dom) -- cgit v1.2.3 From 789d95e669710036adc1734938e57ceb3b3d46bb Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 14 Mar 2003 02:11:42 -0800 Subject: [PATCH] kNFSd: Fix deadlock problem in lockd. nlmsvc_lock calls nlmsvc_create_block with file->f_sema held. nlmsvc_create_block calls nlmclnt_lookup_host which might call nlm_gc_hosts which might, eventually, try to claim file->f_sema for the same file -> deadlock. nlmsvc_create_block does not need any protection under any lock as lockd is single-threaded and _create_block only plays with internal data structures. So we release the f_sema before calling in, and make sure it gets claimed again afterwards. --- fs/lockd/svclock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 8a827b109c93..dfb16a579c99 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -305,8 +305,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, (long long)lock->fl.fl_end, wait); - /* Lock file against concurrent access */ - down(&file->f_sema); /* Get existing block (in case client is busy-waiting) */ block = nlmsvc_lookup_block(file, lock, 0); @@ -314,6 +312,9 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, lock->fl.fl_flags |= FL_LOCKD; again: + /* Lock file against concurrent access */ + down(&file->f_sema); + if (!(conflock = posix_test_lock(&file->f_file, &lock->fl))) { error = posix_lock_file(&file->f_file, &lock->fl); @@ -346,7 +347,10 @@ again: /* If we don't have a block, create and initialize it. Then * retry because we may have slept in kmalloc. */ + /* We have to release f_sema as nlmsvc_create_block may try to + * to claim it while doing host garbage collection */ if (block == NULL) { + up(&file->f_sema); dprintk("lockd: blocking on this lock (allocating).\n"); if (!(block = nlmsvc_create_block(rqstp, file, lock, cookie))) return nlm_lck_denied_nolocks; -- cgit v1.2.3 From 0d32f5653c17b73f10e6ba2488b03467beb7b37d Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 14 Mar 2003 02:11:55 -0800 Subject: [PATCH] kNFSd: Rename NFSEXP_CROSSMNT to NFSEXP_NOHIDE becase nohide is the user-space visible name for the flag, and we are about to define a real CROSSMNT. --- fs/nfsd/export.c | 2 +- fs/nfsd/vfs.c | 6 +++--- include/linux/nfsd/export.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'fs') diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index dfb58e34aefa..00caf0afa1be 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -917,7 +917,7 @@ struct flags { { NFSEXP_UIDMAP, {"uidmap", ""}}, { NFSEXP_KERBEROS, { "kerberos", ""}}, { NFSEXP_SUNSECURE, { "sunsecure", ""}}, - { NFSEXP_CROSSMNT, {"nohide", ""}}, + { NFSEXP_NOHIDE, {"nohide", ""}}, { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}}, { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}}, #ifdef MSNFS diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 088ee1438f54..e869ef882cd6 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -79,7 +79,7 @@ static struct raparms * raparm_cache; * N.B. After this call _both_ fhp and resfh need an fh_put * * If the lookup would cross a mountpoint, and the mounted filesystem - * is exported to the client with NFSEXP_CROSSMNT, then the lookup is + * is exported to the client with NFSEXP_NOHIDE, then the lookup is * accepted as it stands and the mounted directory is * returned. Otherwise the covered directory is returned. * NOTE: this mountpoint crossing is not supported properly by all @@ -115,7 +115,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, read_lock(&dparent_lock); dentry = dget(dparent->d_parent); read_unlock(&dparent_lock); - } else if (!EX_CROSSMNT(exp)) + } else if (!EX_NOHIDE(exp)) dentry = dget(dparent); /* .. == . just like at / */ else { /* checking mountpoint crossing is very different when stepping up */ @@ -159,7 +159,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, ; exp2 = exp_get_by_name(exp->ex_client, mnt, mounts, &rqstp->rq_chandle); - if (exp2 && EX_CROSSMNT(exp2)) { + if (exp2 && EX_NOHIDE(exp2)) { /* successfully crossed mount point */ exp_put(exp); exp = exp2; diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index 864e3b801f0f..c37f57ae878b 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h @@ -35,7 +35,7 @@ #define NFSEXP_UIDMAP 0x0040 #define NFSEXP_KERBEROS 0x0080 /* not available */ #define NFSEXP_SUNSECURE 0x0100 -#define NFSEXP_CROSSMNT 0x0200 +#define NFSEXP_NOHIDE 0x0200 #define NFSEXP_NOSUBTREECHECK 0x0400 #define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ #define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */ @@ -73,7 +73,7 @@ struct svc_expkey { #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) #define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY) -#define EX_CROSSMNT(exp) ((exp)->ex_flags & NFSEXP_CROSSMNT) +#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) #define EX_SUNSECURE(exp) ((exp)->ex_flags & NFSEXP_SUNSECURE) #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) -- cgit v1.2.3 From 4d4d890f5e4b91fe7b795d09852b3c4d1f13f389 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 14 Mar 2003 02:12:01 -0800 Subject: [PATCH] kNFSd: Introduce CROSSMNT flag for knfsd Now that we have working up-calls to userspace, CROSSMNT makes sense. If CROSSMNT is set for an export, and we too a LOOKUP which crosses a mountpoint, we initiate an upcall to find out if and how that filesystem is exported. --- fs/nfsd/export.c | 9 ++++++++- fs/nfsd/vfs.c | 18 +++++++++++++++++- include/linux/nfsd/export.h | 3 ++- 3 files changed, 27 insertions(+), 3 deletions(-) (limited to 'fs') diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 00caf0afa1be..4ea38a35403e 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -475,8 +475,14 @@ exp_get_by_name(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry, exp = svc_export_lookup(&key, 0); if (exp != NULL) - if (cache_check(&svc_export_cache, &exp->h, reqp)) + switch (cache_check(&svc_export_cache, &exp->h, reqp)) { + case 0: break; + case -EAGAIN: + exp = ERR_PTR(-EAGAIN); + break; + default: exp = NULL; + } return exp; } @@ -918,6 +924,7 @@ struct flags { { NFSEXP_KERBEROS, { "kerberos", ""}}, { NFSEXP_SUNSECURE, { "sunsecure", ""}}, { NFSEXP_NOHIDE, {"nohide", ""}}, + { NFSEXP_CROSSMNT, {"crossmnt", ""}}, { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}}, { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}}, #ifdef MSNFS diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index e869ef882cd6..d749aef9c3a5 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -133,6 +133,12 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, exp2 = exp_parent(exp->ex_client, mnt, dentry, &rqstp->rq_chandle); + if (IS_ERR(exp2)) { + err = PTR_ERR(exp2); + dput(dentry); + mntput(mnt); + goto out; + } if (!exp2) { dput(dentry); dentry = dget(dparent); @@ -157,9 +163,19 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, struct dentry *mounts = dget(dentry); while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)) ; + exp2 = exp_get_by_name(exp->ex_client, mnt, mounts, &rqstp->rq_chandle); - if (exp2 && EX_NOHIDE(exp2)) { + if (IS_ERR(exp2)) { + err = PTR_ERR(exp2); + dput(mounts); + dput(dentry); + mntput(mnt); + goto out; + } + if (exp2 && + ((exp->ex_flags & NFSEXP_CROSSMNT) + || EX_NOHIDE(exp2))) { /* successfully crossed mount point */ exp_put(exp); exp = exp2; diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index c37f57ae878b..48860ac34dae 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h @@ -40,7 +40,8 @@ #define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ #define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */ #define NFSEXP_FSID 0x2000 -#define NFSEXP_ALLFLAGS 0x3FFF +#define NFSEXP_CROSSMNT 0x4000 +#define NFSEXP_ALLFLAGS 0x7FFF #ifdef __KERNEL__ -- cgit v1.2.3 From 0b6af0f07c7ba3ec5355f3d86b1f2c13e922c84c Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 15 Mar 2003 01:17:32 +0300 Subject: reiserfs: Correctly free all the allocated memory if open of the journal failed. Also added \n to some error messages. --- fs/reiserfs/journal.c | 76 ++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'fs') diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index d90636bfe358..bd15acb84aa9 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -1310,6 +1310,10 @@ static void free_journal_ram(struct super_block *p_s_sb) { if (SB_JOURNAL(p_s_sb)->j_header_bh) { brelse(SB_JOURNAL(p_s_sb)->j_header_bh) ; } + /* j_header_bh is on the journal dev, make sure not to release the journal + * dev until we brelse j_header_bh + */ + release_journal_dev(p_s_sb, SB_JOURNAL(p_s_sb)); vfree(SB_JOURNAL(p_s_sb)) ; } @@ -1341,7 +1345,6 @@ static int do_journal_release(struct reiserfs_transaction_handle *th, struct sup commit_wq = NULL; } - release_journal_dev( p_s_sb, SB_JOURNAL( p_s_sb ) ); free_journal_ram(p_s_sb) ; return 0 ; @@ -1867,24 +1870,18 @@ static int release_journal_dev( struct super_block *super, int result; result = 0; - if( journal -> j_dev_file != NULL ) { - /* - * journal block device was taken via filp_open - */ result = filp_close( journal -> j_dev_file, NULL ); journal -> j_dev_file = NULL; journal -> j_dev_bd = NULL; } else if( journal -> j_dev_bd != NULL ) { - /* - * journal block device was taken via bdget and blkdev_get - */ result = blkdev_put( journal -> j_dev_bd, BDEV_FS ); journal -> j_dev_bd = NULL; } + if( result != 0 ) { - reiserfs_warning("sh-457: release_journal_dev: Cannot release journal device: %i", result ); + reiserfs_warning("sh-457: release_journal_dev: Cannot release journal device: %i\n", result ); } return result; } @@ -1895,6 +1892,7 @@ static int journal_init_dev( struct super_block *super, { int result; dev_t jdev; + int blkdev_mode = FMODE_READ | FMODE_WRITE; result = 0; @@ -1902,12 +1900,16 @@ static int journal_init_dev( struct super_block *super, journal -> j_dev_file = NULL; jdev = SB_ONDISK_JOURNAL_DEVICE( super ) ? SB_ONDISK_JOURNAL_DEVICE( super ) : super->s_dev; + + if (bdev_read_only(super->s_bdev)) + blkdev_mode = FMODE_READ; + /* there is no "jdev" option and journal is on separate device */ if( ( !jdev_name || !jdev_name[ 0 ] ) ) { journal -> j_dev_bd = bdget(jdev); if( journal -> j_dev_bd ) result = blkdev_get( journal -> j_dev_bd, - FMODE_READ | FMODE_WRITE, 0, + blkdev_mode, 0, BDEV_FS ); else result = -ENOMEM; @@ -1928,10 +1930,10 @@ static int journal_init_dev( struct super_block *super, jdev_inode = journal -> j_dev_file -> f_dentry -> d_inode; journal -> j_dev_bd = jdev_inode -> i_bdev; if( !S_ISBLK( jdev_inode -> i_mode ) ) { - printk( "journal_init_dev: '%s' is not a block device", jdev_name ); + printk( "journal_init_dev: '%s' is not a block device\n", jdev_name ); result = -ENOTBLK; } else if( jdev_inode -> i_bdev == NULL ) { - printk( "journal_init_dev: bdev uninitialized for '%s'", jdev_name ); + printk( "journal_init_dev: bdev uninitialized for '%s'\n", jdev_name ); result = -ENOMEM; } else { /* ok */ @@ -1941,12 +1943,12 @@ static int journal_init_dev( struct super_block *super, } else { result = PTR_ERR( journal -> j_dev_file ); journal -> j_dev_file = NULL; - printk( "journal_init_dev: Cannot open '%s': %i", jdev_name, result ); + printk( "journal_init_dev: Cannot open '%s': %i\n", jdev_name, result ); } if( result != 0 ) { release_journal_dev( super, journal ); } - printk( "journal_init_dev: journal device: %s", bdevname(journal->j_dev_bd)); + printk( "journal_init_dev: journal device: %s\n", bdevname(journal->j_dev_bd)); return result; } @@ -1960,20 +1962,24 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo struct reiserfs_journal_header *jh; struct reiserfs_journal *journal; - if (sizeof(struct reiserfs_journal_commit) != 4096 || - sizeof(struct reiserfs_journal_desc) != 4096 - ) { - printk("journal-1249: commit or desc struct not 4096 %Zd %Zd\n", sizeof(struct reiserfs_journal_commit), + if (sizeof(struct reiserfs_journal_commit) != 4096 || + sizeof(struct reiserfs_journal_desc) != 4096) { + printk("journal-1249: commit or desc struct not 4096 %Zd %Zd\n", sizeof(struct reiserfs_journal_commit), sizeof(struct reiserfs_journal_desc)) ; - return 1 ; - } + return 1 ; + } journal = SB_JOURNAL(p_s_sb) = vmalloc(sizeof (struct reiserfs_journal)) ; if (!journal) { printk("journal-1256: unable to get memory for journal structure\n") ; - return 1 ; - } + return 1 ; + } memset(journal, 0, sizeof(struct reiserfs_journal)) ; + INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_bitmap_nodes) ; + INIT_LIST_HEAD (&SB_JOURNAL(p_s_sb)->j_prealloc_list); + reiserfs_allocate_list_bitmaps(p_s_sb, SB_JOURNAL(p_s_sb)->j_list_bitmap, + SB_BMAP_NR(p_s_sb)) ; + allocate_bitmap_nodes(p_s_sb) ; /* reserved for journal area support */ SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) = (old_format ? @@ -1983,7 +1989,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo if( journal_init_dev( p_s_sb, journal, j_dev_name ) != 0 ) { printk( "sh-462: unable to initialize jornal device\n"); - return 1; + goto free_and_return; } rs = SB_DISK_SUPER_BLOCK(p_s_sb); @@ -1993,8 +1999,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) + SB_ONDISK_JOURNAL_SIZE(p_s_sb)); if (!bhjh) { printk("sh-459: unable to read journal header\n") ; - release_journal_dev(p_s_sb, journal); - return 1 ; + goto free_and_return; } jh = (struct reiserfs_journal_header *)(bhjh->b_data); @@ -2005,8 +2010,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo jh->jh_journal.jp_journal_magic, bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd ), sb_jp_journal_magic(rs), reiserfs_bdevname (p_s_sb)); brelse (bhjh); - release_journal_dev(p_s_sb, journal); - return 1 ; + goto free_and_return; } SB_JOURNAL_TRANS_MAX(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_trans_max); @@ -2064,7 +2068,6 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo brelse (bhjh); - SB_JOURNAL(p_s_sb)->j_list_bitmap_index = 0 ; SB_JOURNAL_LIST_INDEX(p_s_sb) = -10000 ; /* make sure flush_old_commits does not try to flush a list while replay is on */ @@ -2075,12 +2078,8 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo memset(SB_JOURNAL(p_s_sb)->j_list_hash_table, 0, JOURNAL_HASH_SIZE * sizeof(struct reiserfs_journal_cnode *)) ; memset(journal_writers, 0, sizeof(char *) * 512) ; /* debug code */ - INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_bitmap_nodes) ; INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_dirty_buffers) ; spin_lock_init(&SB_JOURNAL(p_s_sb)->j_dirty_buffers_lock) ; - reiserfs_allocate_list_bitmaps(p_s_sb, SB_JOURNAL(p_s_sb)->j_list_bitmap, - SB_BMAP_NR(p_s_sb)) ; - allocate_bitmap_nodes(p_s_sb) ; SB_JOURNAL(p_s_sb)->j_start = 0 ; SB_JOURNAL(p_s_sb)->j_len = 0 ; @@ -2107,20 +2106,15 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo SB_JOURNAL_LIST(p_s_sb)[0].j_list_bitmap = get_list_bitmap(p_s_sb, SB_JOURNAL_LIST(p_s_sb)) ; if (!(SB_JOURNAL_LIST(p_s_sb)[0].j_list_bitmap)) { reiserfs_warning("journal-2005, get_list_bitmap failed for journal list 0\n") ; - release_journal_dev(p_s_sb, journal); - return 1 ; + goto free_and_return; } if (journal_read(p_s_sb) < 0) { reiserfs_warning("Replay Failure, unable to mount\n") ; - free_journal_ram(p_s_sb) ; - release_journal_dev(p_s_sb, journal); - return 1 ; + goto free_and_return; } SB_JOURNAL_LIST_INDEX(p_s_sb) = 0 ; /* once the read is done, we can set this where it belongs */ - INIT_LIST_HEAD (&SB_JOURNAL(p_s_sb)->j_prealloc_list); - if (reiserfs_dont_log (p_s_sb)) return 0; @@ -2129,7 +2123,9 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo commit_wq = create_workqueue("reiserfs"); return 0 ; - +free_and_return: + free_journal_ram(p_s_sb); + return 1; } /* -- cgit v1.2.3 From 967e03ff22acda6d5b43d51d2d0f17643d345b27 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sat, 15 Mar 2003 01:19:32 -0800 Subject: [PATCH] update filesystems config. menu This is Robert PJ Day's patch that updates the filesystems config menu. It had become a bit ad hoc (jumbled:) and this patch attempts to arrange it more logically. --- fs/Kconfig | 1885 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 954 insertions(+), 931 deletions(-) (limited to 'fs') diff --git a/fs/Kconfig b/fs/Kconfig index 1697ef34c9a5..4d207c254079 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -4,89 +4,180 @@ menu "File systems" -config QUOTA - bool "Quota support" +config EXT2_FS + tristate "Second extended fs support" help - If you say Y here, you will be able to set per user limits for disk - usage (also called disk quotas). Currently, it works for the - ext2, ext3, and reiserfs file system. You need additional software - in order to use quota support (you can download sources from - ). For further details, read - the Quota mini-HOWTO, available from - . Probably the quota - support is only useful for multi user systems. If unsure, say N. + This is the de facto standard Linux file system (method to organize + files on a storage device) for hard disks. -config QFMT_V1 - tristate "Old quota format support" - depends on QUOTA + You want to say Y here, unless you intend to use Linux exclusively + from inside a DOS partition using the UMSDOS file system. The + advantage of the latter is that you can get away without + repartitioning your hard drive (which often implies backing + everything up and restoring afterwards); the disadvantage is that + Linux becomes susceptible to DOS viruses and that UMSDOS is somewhat + slower than ext2fs. Even if you want to run Linux in this fashion, + it might be a good idea to have ext2fs around: it enables you to + read more floppy disks and facilitates the transition to a *real* + Linux partition later. Another (rare) case which doesn't require + ext2fs is a diskless Linux box which mounts all files over the + network using NFS (in this case it's sufficient to say Y to "NFS + file system support" below). Saying Y here will enlarge your kernel + by about 44 KB. + + The Ext2fs-Undeletion mini-HOWTO, available from + , gives information about + how to retrieve deleted files on ext2fs file systems. + + To change the behavior of ext2 file systems, you can use the tune2fs + utility ("man tune2fs"). To modify attributes of files and + directories on ext2 file systems, use chattr ("man chattr"). + + Ext2fs partitions can be read from within DOS using the ext2tool + command line tool package (available from + ) and from + within Windows NT using the ext2nt command line tool package from + . Explore2fs is a + graphical explorer for ext2fs partitions which runs on Windows 95 + and Windows NT and includes experimental write support; it is + available from + . + + If you want to compile this file system as a module ( = code which + can be inserted in and removed from the running kernel whenever you + want), say M here and read . The + module will be called ext2. Be aware however that the file system + of your root partition (the one containing the directory /) cannot + be compiled as a module, and so this could be dangerous. Most + everyone wants to say Y here. + +config EXT2_FS_XATTR + bool "Ext2 extended attributes" + depends on EXT2_FS help - This quota format was (is) used by kernels earlier than 2.4.??. If - you have quota working and you don't want to convert to new quota - format say Y here. + Extended attributes are name:value pairs associated with inodes by + the kernel or by users (see the attr(5) manual page, or visit + for details). -config QFMT_V2 - tristate "Quota format v2 support" - depends on QUOTA + If unsure, say N. + +config EXT2_FS_POSIX_ACL + bool "Ext2 POSIX Access Control Lists" + depends on EXT2_FS_XATTR help - This quota format allows using quotas with 32-bit UIDs/GIDs. If you - need this functionality say Y here. Note that you will need latest - quota utilities for new quota format with this kernel. + Posix Access Control Lists (ACLs) support permissions for users and + groups beyond the owner/group/world scheme. -config QUOTACTL - bool - depends on XFS_QUOTA || QUOTA + To learn more about Access Control Lists, visit the Posix ACLs for + Linux website . + + If you don't know what Access Control Lists are, say N + +config EXT3_FS + tristate "Ext3 journalling file system support" + help + This is the journaling version of the Second extended file system + (often called ext3), the de facto standard Linux file system + (method to organize files on a storage device) for hard disks. + + The journaling code included in this driver means you do not have + to run e2fsck (file system checker) on your file systems after a + crash. The journal keeps track of any changes that were being made + at the time the system crashed, and can ensure that your file system + is consistent without the need for a lengthy check. + + Other than adding the journal to the file system, the on-disk format + of ext3 is identical to ext2. It is possible to freely switch + between using the ext3 driver and the ext2 driver, as long as the + file system has been cleanly unmounted, or e2fsck is run on the file + system. + + To add a journal on an existing ext2 file system or change the + behavior of ext3 file systems, you can use the tune2fs utility ("man + tune2fs"). To modify attributes of files and directories on ext3 + file systems, use chattr ("man chattr"). You need to be using + e2fsprogs version 1.20 or later in order to create ext3 journals + (available at ). + + If you want to compile this file system as a module ( = code which + can be inserted in and removed from the running kernel whenever you + want), say M here and read . The + module will be called ext3. Be aware however that the file system + of your root partition (the one containing the directory /) cannot + be compiled as a module, and so this may be dangerous. + +config EXT3_FS_XATTR + bool "Ext3 extended attributes" + depends on EXT3_FS default y + help + Extended attributes are name:value pairs associated with inodes by + the kernel or by users (see the attr(5) manual page, or visit + for details). -config AUTOFS_FS - tristate "Kernel automounter support" - ---help--- - The automounter is a tool to automatically mount remote file systems - on demand. This implementation is partially kernel-based to reduce - overhead in the already-mounted case; this is unlike the BSD - automounter (amd), which is a pure user space daemon. + If unsure, say N. - To use the automounter you need the user-space tools from the autofs - package; you can find the location in . - You also want to answer Y to "NFS file system support", below. + You need this for POSIX ACL support on ext3. - If you want to use the newer version of the automounter with more - features, say N here and say Y to "Kernel automounter v4 support", - below. +config EXT3_FS_POSIX_ACL + bool "Ext3 POSIX Access Control Lists" + depends on EXT3_FS_XATTR + help + Posix Access Control Lists (ACLs) support permissions for users and + groups beyond the owner/group/world scheme. - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called autofs. + To learn more about Access Control Lists, visit the Posix ACLs for + Linux website . - If you are not a part of a fairly large, distributed network, you - probably do not need an automounter, and can say N here. + If you don't know what Access Control Lists are, say N -config AUTOFS4_FS - tristate "Kernel automounter version 4 support (also supports v3)" - ---help--- - The automounter is a tool to automatically mount remote file systems - on demand. This implementation is partially kernel-based to reduce - overhead in the already-mounted case; this is unlike the BSD - automounter (amd), which is a pure user space daemon. +config JBD +# CONFIG_JBD could be its own option (even modular), but until there are +# other users than ext3, we will simply make it be the same as CONFIG_EXT3_FS +# dep_tristate ' Journal Block Device support (JBD for ext3)' CONFIG_JBD $CONFIG_EXT3_FS + bool + default EXT3_FS + help + This is a generic journaling layer for block devices. It is + currently used by the ext3 file system, but it could also be used to + add journal support to other file systems or block devices such as + RAID or LVM. - To use the automounter you need the user-space tools from - ; you also - want to answer Y to "NFS file system support", below. + If you are using the ext3 file system, you need to say Y here. If + you are not using ext3 then you will probably want to say N. - If you want to compile this as a module ( = code which can be + If you want to compile this device as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read . The module - will be called autofs4. You will need to add "alias autofs - autofs4" to your modules configuration file. + will be called jbd. If you are compiling ext3 into the kernel, + you cannot compile this code as a module. - If you are not a part of a fairly large, distributed network or - don't have a laptop which needs to dynamically reconfigure to the - local network, you probably do not need an automounter, and can say - N here. +config JBD_DEBUG + bool "JBD (ext3) debugging support" + depends on JBD + help + If you are using the ext3 journaled file system (or potentially any + other file system/device using JBD), this option allows you to + enable debugging output while the system is running, in order to + help track down any problems you are having. By default the + debugging output will be turned off. + + If you select Y here, then you will be able to turn on debugging + with "echo N > /proc/sys/fs/jbd-debug", where N is a number between + 1 and 5, the higher the number, the more debugging output is + generated. To turn debugging off again, do + "echo 0 > /proc/sys/fs/jbd-debug". + +config FS_MBCACHE +# Meta block cache for Extended Attributes (ext2/ext3) + tristate + depends on EXT2_FS_XATTR || EXT3_FS_XATTR + default y if EXT2_FS=y || EXT3_FS=y + default m if EXT2_FS=m || EXT3_FS=m config REISERFS_FS tristate "Reiserfs support" - ---help--- + help Stores not just filenames but the files themselves in a balanced tree. Uses journaling. @@ -135,40 +226,653 @@ config REISERFS_PROC_INFO Almost everyone but ReiserFS developers and people fine-tuning reiserfs or tracing problems should say N. -config ADFS_FS - tristate "ADFS file system support (EXPERIMENTAL)" - depends on EXPERIMENTAL - ---help--- - The Acorn Disc Filing System is the standard file system of the - RiscOS operating system which runs on Acorn's ARM-based Risc PC - systems and the Acorn Archimedes range of machines. If you say Y - here, Linux will be able to read from ADFS partitions on hard drives - and from ADFS-formatted floppy discs. If you also want to be able to - write to those devices, say Y to "ADFS write support" below. +config JFS_FS + tristate "JFS filesystem support" + help + This is a port of IBM's Journaled Filesystem . More information is + available in the file Documentation/filesystems/jfs.txt. - The ADFS partition should be the first partition (i.e., - /dev/[hs]d?1) on each of your drives. Please read the file - for further details. + If you do not intend to use the JFS filesystem, say N. - This code is also available as a module called adfs ( = code which - can be inserted in and removed from the running kernel whenever you - want). If you want to compile it as a module, say M here and read - . +config JFS_POSIX_ACL + bool "JFS POSIX Access Control Lists" + depends on JFS_FS + help + Posix Access Control Lists (ACLs) support permissions for users and + groups beyond the owner/group/world scheme. - If unsure, say N. + To learn more about Access Control Lists, visit the Posix ACLs for + Linux website . -config ADFS_FS_RW - bool "ADFS write support (DANGEROUS)" - depends on ADFS_FS - help - If you say Y here, you will be able to write to ADFS partitions on - hard drives and ADFS-formatted floppy disks. This is experimental - codes, so if you're unsure, say N. + If you don't know what Access Control Lists are, say N -config AFFS_FS +config JFS_DEBUG + bool "JFS debugging" + depends on JFS_FS + help + If you are experiencing any problems with the JFS filesystem, say + Y here. This will result in additional debugging messages to be + written to the system log. Under normal circumstances, this + results in very little overhead. + +config JFS_STATISTICS + bool "JFS statistics" + depends on JFS_FS + help + Enabling this option will cause statistics from the JFS file system + to be made available to the user in the /proc/fs/jfs/ directory. + +config FS_POSIX_ACL +# Posix ACL utility routines (for now, only ext2/ext3/jfs) +# +# NOTE: you can implement Posix ACLs without these helpers (XFS does). +# Never use this symbol for ifdefs. +# + bool + depends on EXT2_FS_POSIX_ACL || EXT3_FS_POSIX_ACL || JFS_POSIX_ACL + default y + +config XFS_FS + tristate "XFS filesystem support" + help + XFS is a high performance journaling filesystem which originated + on the SGI IRIX platform. It is completely multi-threaded, can + support large files and large filesystems, extended attributes, + variable block sizes, is extent based, and makes extensive use of + Btrees (directories, extents, free space) to aid both performance + and scalability. + + Refer to the documentation at + for complete details. This implementation is on-disk compatible + with the IRIX version of XFS. + + If you want to compile this file system as a module ( = code which + can be inserted in and removed from the running kernel whenever you + want), say M here and read . The + module will be called xfs. Be aware, however, that if the file + system of your root partition is compiled as a module, you'll need + to use an initial ramdisk (initrd) to boot. + +config XFS_RT + bool "Realtime support (EXPERIMENTAL)" + depends on XFS_FS && EXPERIMENTAL + help + If you say Y here you will be able to mount and use XFS filesystems + which contain a realtime subvolume. The realtime subvolume is a + separate area of disk space where only file data is stored. The + realtime subvolume is designed to provide very deterministic + data rates suitable for media streaming applications. + + See the xfs man page in section 5 for a bit more information. + + This feature is unsupported at this time, is not yet fully + functional, and may cause serious problems. + + If unsure, say N. + +config XFS_QUOTA + bool "Quota support" + depends on XFS_FS + help + If you say Y here, you will be able to set limits for disk usage on + a per user and/or a per group basis under XFS. XFS considers quota + information as filesystem metadata and uses journaling to provide a + higher level guarantee of consistency. The on-disk data format for + quota is also compatible with the IRIX version of XFS, allowing a + filesystem to be migrated between Linux and IRIX without any need + for conversion. + + If unsure, say N. More comprehensive documentation can be found in + README.quota in the xfsprogs package. XFS quota can be used either + with or without the generic quota support enabled (CONFIG_QUOTA) - + they are completely independent subsystems. + +config XFS_POSIX_ACL + bool "ACL support" + depends on XFS_FS + help + Posix Access Control Lists (ACLs) support permissions for users and + groups beyond the owner/group/world scheme. + + To learn more about Access Control Lists, visit the Posix ACLs for + Linux website . + + If you don't know what Access Control Lists are, say N + +config MINIX_FS + tristate "Minix fs support" + help + Minix is a simple operating system used in many classes about OS's. + The minix file system (method to organize files on a hard disk + partition or a floppy disk) was the original file system for Linux, + but has been superseded by the second extended file system ext2fs. + You don't want to use the minix file system on your hard disk + because of certain built-in restrictions, but it is sometimes found + on older Linux floppy disks. This option will enlarge your kernel + by about 28 KB. If unsure, say N. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called minix. Note that the file system of your root + partition (the one containing the directory /) cannot be compiled as + a module. + +config ROMFS_FS + tristate "ROM file system support" + ---help--- + This is a very small read-only file system mainly intended for + initial ram disks of installation disks, but it could be used for + other read-only media as well. Read + for details. + + This file system support is also available as a module ( = code + which can be inserted in and removed from the running kernel + whenever you want). The module is called romfs. If you want to + compile it as a module, say M here and read + . Note that the file system of your + root partition (the one containing the directory /) cannot be a + module. + + If you don't know whether you need it, then you don't need it: + answer N. + +config HUGETLBFS + bool "HugeTLB file system support" + depends on HUGETLB_PAGE + +config QUOTA + bool "Quota support" + help + If you say Y here, you will be able to set per user limits for disk + usage (also called disk quotas). Currently, it works for the + ext2, ext3, and reiserfs file system. You need additional software + in order to use quota support (you can download sources from + ). For further details, read + the Quota mini-HOWTO, available from + . Probably the quota + support is only useful for multi user systems. If unsure, say N. + +config QFMT_V1 + tristate "Old quota format support" + depends on QUOTA + help + This quota format was (is) used by kernels earlier than 2.4.??. If + you have quota working and you don't want to convert to new quota + format say Y here. + +config QFMT_V2 + tristate "Quota format v2 support" + depends on QUOTA + help + This quota format allows using quotas with 32-bit UIDs/GIDs. If you + need this functionality say Y here. Note that you will need latest + quota utilities for new quota format with this kernel. + +config QUOTACTL + bool + depends on XFS_QUOTA || QUOTA + default y + +config AUTOFS_FS + tristate "Kernel automounter support" + help + The automounter is a tool to automatically mount remote file systems + on demand. This implementation is partially kernel-based to reduce + overhead in the already-mounted case; this is unlike the BSD + automounter (amd), which is a pure user space daemon. + + To use the automounter you need the user-space tools from the autofs + package; you can find the location in . + You also want to answer Y to "NFS file system support", below. + + If you want to use the newer version of the automounter with more + features, say N here and say Y to "Kernel automounter v4 support", + below. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called autofs. + + If you are not a part of a fairly large, distributed network, you + probably do not need an automounter, and can say N here. + +config AUTOFS4_FS + tristate "Kernel automounter version 4 support (also supports v3)" + help + The automounter is a tool to automatically mount remote file systems + on demand. This implementation is partially kernel-based to reduce + overhead in the already-mounted case; this is unlike the BSD + automounter (amd), which is a pure user space daemon. + + To use the automounter you need the user-space tools from + ; you also + want to answer Y to "NFS file system support", below. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called autofs4. You will need to add "alias autofs + autofs4" to your modules configuration file. + + If you are not a part of a fairly large, distributed network or + don't have a laptop which needs to dynamically reconfigure to the + local network, you probably do not need an automounter, and can say + N here. + +menu "CD-ROM/DVD Filesystems" + +config ISO9660_FS + tristate "ISO 9660 CDROM file system support" + help + This is the standard file system used on CD-ROMs. It was previously + known as "High Sierra File System" and is called "hsfs" on other + Unix systems. The so-called Rock-Ridge extensions which allow for + long Unix filenames and symbolic links are also supported by this + driver. If you have a CD-ROM drive and want to do more with it than + just listen to audio CDs and watch its LEDs, say Y (and read + and the CD-ROM-HOWTO, + available from ), thereby + enlarging your kernel by about 27 KB; otherwise say N. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called isofs. + +config JOLIET + bool "Microsoft Joliet CDROM extensions" + depends on ISO9660_FS + help + Joliet is a Microsoft extension for the ISO 9660 CD-ROM file system + which allows for long filenames in unicode format (unicode is the + new 16 bit character code, successor to ASCII, which encodes the + characters of almost all languages of the world; see + for more information). Say Y here if you + want to be able to read Joliet CD-ROMs under Linux. + +config ZISOFS + bool "Transparent decompression extension" + depends on ISO9660_FS + help + This is a Linux-specific extension to RockRidge which lets you store + data in compressed form on a CD-ROM and have it transparently + decompressed when the CD-ROM is accessed. See + for the tools + necessary to create such a filesystem. Say Y here if you want to be + able to read such compressed CD-ROMs. + +config ZISOFS_FS +# for fs/nls/Config.in + tristate + depends on ZISOFS + default ISO9660_FS + +config UDF_FS + tristate "UDF file system support" + help + This is the new file system used on some CD-ROMs and DVDs. Say Y if + you intend to mount DVD discs or CDRW's written in packet mode, or + if written to by other UDF utilities, such as DirectCD. + Please read . + + This file system support is also available as a module ( = code + which can be inserted in and removed from the running kernel + whenever you want). The module is called udf. If you want to + compile it as a module, say M here and read + . + + If unsure, say N. + +endmenu + +menu "DOS/FAT/NT Filesystems" + +config FAT_FS + tristate "DOS FAT fs support" + help + If you want to use one of the FAT-based file systems (the MS-DOS, + VFAT (Windows 95) and UMSDOS (used to run Linux on top of an + ordinary DOS partition) file systems), then you must say Y or M here + to include FAT support. You will then be able to mount partitions or + diskettes with FAT-based file systems and transparently access the + files on them, i.e. MSDOS files will look and behave just like all + other Unix files. + + This FAT support is not a file system in itself, it only provides + the foundation for the other file systems. You will have to say Y or + M to at least one of "MSDOS fs support" or "VFAT fs support" in + order to make use of it. + + Another way to read and write MSDOS floppies and hard drive + partitions from within Linux (but not transparently) is with the + mtools ("man mtools") program suite. You don't need to say Y here in + order to do that. + + If you need to move large files on floppies between a DOS and a + Linux box, say Y here, mount the floppy under Linux with an MSDOS + file system and use GNU tar's M option. GNU tar is a program + available for Unix and DOS ("man tar" or "info tar"). + + It is now also becoming possible to read and write compressed FAT + file systems; read for + details. + + The FAT support will enlarge your kernel by about 37 KB. If unsure, + say Y. + + If you want to compile this as a module however ( = code which can + be inserted in and removed from the running kernel whenever you + want), say M here and read . The + module will be called fat. Note that if you compile the FAT + support as a module, you cannot compile any of the FAT-based file + systems into the kernel -- they will have to be modules as well. + The file system of your root partition (the one containing the + directory /) cannot be a module, so don't say M here if you intend + to use UMSDOS as your root file system. + +config MSDOS_FS + tristate "MSDOS fs support" + depends on FAT_FS + help + This allows you to mount MSDOS partitions of your hard drive (unless + they are compressed; to access compressed MSDOS partitions under + Linux, you can either use the DOS emulator DOSEMU, described in the + DOSEMU-HOWTO, available from + , or try dmsdosfs in + . If you + intend to use dosemu with a non-compressed MSDOS partition, say Y + here) and MSDOS floppies. This means that file access becomes + transparent, i.e. the MSDOS files look and behave just like all + other Unix files. + + If you want to use UMSDOS, the Unix-like file system on top of a + DOS file system, which allows you to run Linux from within a DOS + partition without repartitioning, you'll have to say Y or M here. + + If you have Windows 95 or Windows NT installed on your MSDOS + partitions, you should use the VFAT file system (say Y to "VFAT fs + support" below), or you will not be able to see the long filenames + generated by Windows 95 / Windows NT. + + This option will enlarge your kernel by about 7 KB. If unsure, + answer Y. This will only work if you said Y to "DOS FAT fs support" + as well. If you want to compile this as a module however ( = code + which can be inserted in and removed from the running kernel + whenever you want), say M here and read + . + The module will be called msdos. + +config VFAT_FS + tristate "VFAT (Windows-95) fs support" + depends on FAT_FS + help + This option provides support for normal Windows file systems with + long filenames. That includes non-compressed FAT-based file systems + used by Windows 95, Windows 98, Windows NT 4.0, and the Unix + programs from the mtools package. + + You cannot use the VFAT file system for your Linux root partition + (the one containing the directory /); use UMSDOS instead if you + want to run Linux from within a DOS partition (i.e. say Y to + "Unix like fs on top of std MSDOS fs", below). + + The VFAT support enlarges your kernel by about 10 KB and it only + works if you said Y to the "DOS FAT fs support" above. Please read + the file for details. If + unsure, say Y. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called vfat. + +config UMSDOS_FS +#dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS +# UMSDOS is temprory broken + bool + help + Say Y here if you want to run Linux from within an existing DOS + partition of your hard drive. The advantage of this is that you can + get away without repartitioning your hard drive (which often implies + backing everything up and restoring afterwards) and hence you're + able to quickly try out Linux or show it to your friends; the + disadvantage is that Linux becomes susceptible to DOS viruses and + that UMSDOS is somewhat slower than ext2fs. Another use of UMSDOS + is to write files with long unix filenames to MSDOS floppies; it + also allows Unix-style soft-links and owner/permissions of files on + MSDOS floppies. You will need a program called umssync in order to + make use of UMSDOS; read + . + + To get utilities for initializing/checking UMSDOS file system, or + latest patches and/or information, visit the UMSDOS home page at + . + + This option enlarges your kernel by about 28 KB and it only works if + you said Y to both "DOS FAT fs support" and "MSDOS fs support" + above. If you want to compile this as a module ( = code which can + be inserted in and removed from the running kernel whenever you + want), say M here and read . The + module will be called umsdos. Note that the file system of your + root partition (the one containing the directory /) cannot be a + module, so saying M could be dangerous. If unsure, say N. + +config NTFS_FS + tristate "NTFS file system support (read only)" + help + NTFS is the file system of Microsoft Windows NT/2000/XP. For more + information see . Saying Y + here would allow you to read from NTFS partitions. + + This file system is also available as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called ntfs. If you want to compile it as a + module, say M here and read . + + If you are not using Windows NT/2000/XP in addition to Linux on your + computer it is safe to say N. + +config NTFS_DEBUG + bool "NTFS debugging support" + depends on NTFS_FS + help + If you are experiencing any problems with the NTFS file system, say + Y here. This will result in additional consistency checks to be + performed by the driver as well as additional debugging messages to + be written to the system log. Note that debugging messages are + disabled by default. To enable them, supply the option debug_msgs=1 + at the kernel command line when booting the kernel or as an option + to insmod when loading the ntfs module. Once the driver is active, + you can enable debugging messages by doing (as root): + echo 1 > /proc/sys/fs/ntfs-debug + Replacing the "1" with "0" would disable debug messages. + + If you leave debugging messages disabled, this results in little + overhead, but enabling debug messages results in very significant + slowdown of the system. + + When reporting bugs, please try to have available a full dump of + debugging messages while the misbehaviour was occurring. + +config NTFS_RW + bool "NTFS write support (DANGEROUS)" + depends on NTFS_FS && EXPERIMENTAL + help + This enables the experimental write support in the NTFS driver. + + WARNING: Do not use this option unless you are actively developing + NTFS as it is currently guaranteed to be broken and you + may lose all your data! + + It is strongly recommended and perfectly safe to say N here. + +endmenu + +menu "Pseudo filesystems" + +config PROC_FS + bool "/proc file system support" + help + This is a virtual file system providing information about the status + of the system. "Virtual" means that it doesn't take up any space on + your hard disk: the files are created on the fly by the kernel when + you try to access them. Also, you cannot read the files with older + version of the program less: you need to use more or cat. + + It's totally cool; for example, "cat /proc/interrupts" gives + information about what the different IRQs are used for at the moment + (there is a small number of Interrupt ReQuest lines in your computer + that are used by the attached devices to gain the CPU's attention -- + often a source of trouble if two devices are mistakenly configured + to use the same IRQ). The program procinfo to display some + information about your system gathered from the /proc file system. + + Before you can use the /proc file system, it has to be mounted, + meaning it has to be given a location in the directory hierarchy. + That location should be /proc. A command such as "mount -t proc proc + /proc" or the equivalent line in /etc/fstab does the job. + + The /proc file system is explained in the file + and on the proc(5) manpage + ("man 5 proc"). + + This option will enlarge your kernel by about 67 KB. Several + programs depend on this, so everyone should say Y here. + +config DEVFS_FS + bool "/dev file system support (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + This is support for devfs, a virtual file system (like /proc) which + provides the file system interface to device drivers, normally found + in /dev. Devfs does not depend on major and minor number + allocations. Device drivers register entries in /dev which then + appear automatically, which means that the system administrator does + not have to create character and block special device files in the + /dev directory using the mknod command (or MAKEDEV script) anymore. + + This is work in progress. If you want to use this, you *must* read + the material in , especially + the file README there. + + If unsure, say N. + +config DEVFS_MOUNT + bool "Automatically mount at boot" + depends on DEVFS_FS + help + This option appears if you have CONFIG_DEVFS_FS enabled. Setting + this to 'Y' will make the kernel automatically mount devfs onto /dev + when the system is booted, before the init thread is started. + You can override this with the "devfs=nomount" boot option. + + If unsure, say N. + +config DEVFS_DEBUG + bool "Debug devfs" + depends on DEVFS_FS + help + If you say Y here, then the /dev file system code will generate + debugging messages. See the file + for more + details. + + If unsure, say N. + +config DEVPTS_FS +# It compiles as a module for testing only. It should not be used +# as a module in general. If we make this "tristate", a bunch of people +# who don't know what they are doing turn it on and complain when it +# breaks. + bool "/dev/pts file system for Unix98 PTYs" + depends on UNIX98_PTYS + ---help--- + You should say Y here if you said Y to "Unix98 PTY support" above. + You'll then get a virtual file system which can be mounted on + /dev/pts with "mount -t devpts". This, together with the pseudo + terminal master multiplexer /dev/ptmx, is used for pseudo terminal + support as described in The Open Group's Unix98 standard: in order + to acquire a pseudo terminal, a process opens /dev/ptmx; the number + of the pseudo terminal is then made available to the process and the + pseudo terminal slave can be accessed as /dev/pts/. What was + traditionally /dev/ttyp2 will then be /dev/pts/2, for example. + + The GNU C library glibc 2.1 contains the requisite support for this + mode of operation; you also need client programs that use the Unix98 + API. Please read for more information + about the Unix98 pty devices. + + Note that the experimental "/dev file system support" + (CONFIG_DEVFS_FS) is a more general facility. + +config TMPFS + bool "Virtual memory file system support (former shm fs)" + help + Tmpfs is a file system which keeps all files in virtual memory. + + Everything in tmpfs is temporary in the sense that no files will be + created on your hard drive. The files live in memory and swap + space. If you unmount a tmpfs instance, everything stored therein is + lost. + + See for details. + +config RAMFS + bool + default y + ---help--- + Ramfs is a file system which keeps all files in RAM. It allows + read and write access. + + It is more of an programming example than a useable file system. If + you need a file system which lives in RAM with limit checking use + tmpfs. + + If you want to compile this as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read . The module + will be called ramfs. + +endmenu + +menu "Miscellaneous filesystems" + +config ADFS_FS + tristate "ADFS file system support (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + The Acorn Disc Filing System is the standard file system of the + RiscOS operating system which runs on Acorn's ARM-based Risc PC + systems and the Acorn Archimedes range of machines. If you say Y + here, Linux will be able to read from ADFS partitions on hard drives + and from ADFS-formatted floppy discs. If you also want to be able to + write to those devices, say Y to "ADFS write support" below. + + The ADFS partition should be the first partition (i.e., + /dev/[hs]d?1) on each of your drives. Please read the file + for further details. + + This code is also available as a module called adfs ( = code which + can be inserted in and removed from the running kernel whenever you + want). If you want to compile it as a module, say M here and read + . + + If unsure, say N. + +config ADFS_FS_RW + bool "ADFS write support (DANGEROUS)" + depends on ADFS_FS + help + If you say Y here, you will be able to write to ADFS partitions on + hard drives and ADFS-formatted floppy disks. This is experimental + codes, so if you're unsure, say N. + +config AFFS_FS tristate "Amiga FFS file system support (EXPERIMENTAL)" depends on EXPERIMENTAL - ---help--- + help The Fast File System (FFS) is the common file system used on hard disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y if you want to be able to read and write files from and to an Amiga @@ -193,7 +897,7 @@ config AFFS_FS config HFS_FS tristate "Apple Macintosh file system support (EXPERIMENTAL)" depends on EXPERIMENTAL - ---help--- + help If you say Y here, you will be able to mount Macintosh-formatted floppy disks and hard drive partitions with full read-write access. Please read to learn about the available mount @@ -208,7 +912,7 @@ config HFS_FS config BEFS_FS tristate "BeOS file systemv(BeFS) support (read only) (EXPERIMENTAL)" depends on EXPERIMENTAL - ---help--- + help The BeOS File System (BeFS) is the native file system of Be, Inc's BeOS. Notable features include support for arbitrary attributes on files and directories, and database-like indices on selected @@ -236,7 +940,7 @@ config BEFS_DEBUG config BFS_FS tristate "BFS file system support (EXPERIMENTAL)" depends on EXPERIMENTAL - ---help--- + help Boot File System (BFS) is a file system used under SCO UnixWare to allow the bootloader access to the kernel image and other important files during the boot process. It is usually mounted under /stand @@ -256,236 +960,12 @@ config BFS_FS partition (the one containing the directory /) cannot be compiled as a module. -config EXT3_FS - tristate "Ext3 journalling file system support" - ---help--- - This is the journaling version of the Second extended file system - (often called ext3), the de facto standard Linux file system - (method to organize files on a storage device) for hard disks. - - The journaling code included in this driver means you do not have - to run e2fsck (file system checker) on your file systems after a - crash. The journal keeps track of any changes that were being made - at the time the system crashed, and can ensure that your file system - is consistent without the need for a lengthy check. - - Other than adding the journal to the file system, the on-disk format - of ext3 is identical to ext2. It is possible to freely switch - between using the ext3 driver and the ext2 driver, as long as the - file system has been cleanly unmounted, or e2fsck is run on the file - system. - - To add a journal on an existing ext2 file system or change the - behavior of ext3 file systems, you can use the tune2fs utility ("man - tune2fs"). To modify attributes of files and directories on ext3 - file systems, use chattr ("man chattr"). You need to be using - e2fsprogs version 1.20 or later in order to create ext3 journals - (available at ). - - If you want to compile this file system as a module ( = code which - can be inserted in and removed from the running kernel whenever you - want), say M here and read . The - module will be called ext3. Be aware however that the file system - of your root partition (the one containing the directory /) cannot - be compiled as a module, and so this may be dangerous. - -config EXT3_FS_XATTR - bool "Ext3 extended attributes" - depends on EXT3_FS - default y - ---help--- - Extended attributes are name:value pairs associated with inodes by - the kernel or by users (see the attr(5) manual page, or visit - for details). - - If unsure, say N. - - You need this for POSIX ACL support on ext3. - -config EXT3_FS_POSIX_ACL - bool "Ext3 POSIX Access Control Lists" - depends on EXT3_FS_XATTR - ---help--- - Posix Access Control Lists (ACLs) support permissions for users and - groups beyond the owner/group/world scheme. - - To learn more about Access Control Lists, visit the Posix ACLs for - Linux website . - - If you don't know what Access Control Lists are, say N - -# CONFIG_JBD could be its own option (even modular), but until there are -# other users than ext3, we will simply make it be the same as CONFIG_EXT3_FS -# dep_tristate ' Journal Block Device support (JBD for ext3)' CONFIG_JBD $CONFIG_EXT3_FS -config JBD - bool - default EXT3_FS - ---help--- - This is a generic journaling layer for block devices. It is - currently used by the ext3 file system, but it could also be used to - add journal support to other file systems or block devices such as - RAID or LVM. - - If you are using the ext3 file system, you need to say Y here. If - you are not using ext3 then you will probably want to say N. - - If you want to compile this device as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called jbd. If you are compiling ext3 into the kernel, - you cannot compile this code as a module. - -config JBD_DEBUG - bool "JBD (ext3) debugging support" - depends on JBD - ---help--- - If you are using the ext3 journaled file system (or potentially any - other file system/device using JBD), this option allows you to - enable debugging output while the system is running, in order to - help track down any problems you are having. By default the - debugging output will be turned off. - - If you select Y here, then you will be able to turn on debugging - with "echo N > /proc/sys/fs/jbd-debug", where N is a number between - 1 and 5, the higher the number, the more debugging output is - generated. To turn debugging off again, do - "echo 0 > /proc/sys/fs/jbd-debug". - -# msdos file systems -config FAT_FS - tristate "DOS FAT fs support" - ---help--- - If you want to use one of the FAT-based file systems (the MS-DOS, - VFAT (Windows 95) and UMSDOS (used to run Linux on top of an - ordinary DOS partition) file systems), then you must say Y or M here - to include FAT support. You will then be able to mount partitions or - diskettes with FAT-based file systems and transparently access the - files on them, i.e. MSDOS files will look and behave just like all - other Unix files. - - This FAT support is not a file system in itself, it only provides - the foundation for the other file systems. You will have to say Y or - M to at least one of "MSDOS fs support" or "VFAT fs support" in - order to make use of it. - - Another way to read and write MSDOS floppies and hard drive - partitions from within Linux (but not transparently) is with the - mtools ("man mtools") program suite. You don't need to say Y here in - order to do that. - - If you need to move large files on floppies between a DOS and a - Linux box, say Y here, mount the floppy under Linux with an MSDOS - file system and use GNU tar's M option. GNU tar is a program - available for Unix and DOS ("man tar" or "info tar"). - - It is now also becoming possible to read and write compressed FAT - file systems; read for - details. - - The FAT support will enlarge your kernel by about 37 KB. If unsure, - say Y. - - If you want to compile this as a module however ( = code which can - be inserted in and removed from the running kernel whenever you - want), say M here and read . The - module will be called fat. Note that if you compile the FAT - support as a module, you cannot compile any of the FAT-based file - systems into the kernel -- they will have to be modules as well. - The file system of your root partition (the one containing the - directory /) cannot be a module, so don't say M here if you intend - to use UMSDOS as your root file system. - -config MSDOS_FS - tristate "MSDOS fs support" - depends on FAT_FS - ---help--- - This allows you to mount MSDOS partitions of your hard drive (unless - they are compressed; to access compressed MSDOS partitions under - Linux, you can either use the DOS emulator DOSEMU, described in the - DOSEMU-HOWTO, available from - , or try dmsdosfs in - . If you - intend to use dosemu with a non-compressed MSDOS partition, say Y - here) and MSDOS floppies. This means that file access becomes - transparent, i.e. the MSDOS files look and behave just like all - other Unix files. - - If you want to use UMSDOS, the Unix-like file system on top of a - DOS file system, which allows you to run Linux from within a DOS - partition without repartitioning, you'll have to say Y or M here. - - If you have Windows 95 or Windows NT installed on your MSDOS - partitions, you should use the VFAT file system (say Y to "VFAT fs - support" below), or you will not be able to see the long filenames - generated by Windows 95 / Windows NT. - - This option will enlarge your kernel by about 7 KB. If unsure, - answer Y. This will only work if you said Y to "DOS FAT fs support" - as well. If you want to compile this as a module however ( = code - which can be inserted in and removed from the running kernel - whenever you want), say M here and read - . - The module will be called msdos. - -#dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS -# UMSDOS is temprory broken -config UMSDOS_FS - bool - ---help--- - Say Y here if you want to run Linux from within an existing DOS - partition of your hard drive. The advantage of this is that you can - get away without repartitioning your hard drive (which often implies - backing everything up and restoring afterwards) and hence you're - able to quickly try out Linux or show it to your friends; the - disadvantage is that Linux becomes susceptible to DOS viruses and - that UMSDOS is somewhat slower than ext2fs. Another use of UMSDOS - is to write files with long unix filenames to MSDOS floppies; it - also allows Unix-style soft-links and owner/permissions of files on - MSDOS floppies. You will need a program called umssync in order to - make use of UMSDOS; read - . - - To get utilities for initializing/checking UMSDOS file system, or - latest patches and/or information, visit the UMSDOS home page at - . - - This option enlarges your kernel by about 28 KB and it only works if - you said Y to both "DOS FAT fs support" and "MSDOS fs support" - above. If you want to compile this as a module ( = code which can - be inserted in and removed from the running kernel whenever you - want), say M here and read . The - module will be called umsdos. Note that the file system of your - root partition (the one containing the directory /) cannot be a - module, so saying M could be dangerous. If unsure, say N. - -config VFAT_FS - tristate "VFAT (Windows-95) fs support" - depends on FAT_FS - ---help--- - This option provides support for normal Windows file systems with - long filenames. That includes non-compressed FAT-based file systems - used by Windows 95, Windows 98, Windows NT 4.0, and the Unix - programs from the mtools package. - - You cannot use the VFAT file system for your Linux root partition - (the one containing the directory /); use UMSDOS instead if you - want to run Linux from within a DOS partition (i.e. say Y to - "Unix like fs on top of std MSDOS fs", below). - - The VFAT support enlarges your kernel by about 10 KB and it only - works if you said Y to the "DOS FAT fs support" above. Please read - the file for details. If - unsure, say Y. - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called vfat. config EFS_FS tristate "EFS file system support (read only) (EXPERIMENTAL)" depends on EXPERIMENTAL - ---help--- + help EFS is an older file system used for non-ISO9660 CD-ROMs and hard disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer uses the XFS file system for hard disk partitions however). @@ -538,7 +1018,7 @@ config JFFS2_FS_DEBUG int "JFFS2 debugging verbosity (0 = quiet, 2 = noisy)" depends on JFFS2_FS default "0" - ---help--- + help This controls the amount of debugging messages produced by the JFFS2 code. Set it to zero for use in production systems. For evaluation, testing and debugging, it's advisable to set it to one. This will @@ -555,7 +1035,7 @@ config JFFS2_FS_NAND bool "JFFS2 support for NAND flash (EXPERIMENTAL)" depends on JFFS2_FS && EXPERIMENTAL default n - ---help--- + help This enables the experimental support for NAND flash in JFFS2. NAND is a newer type of flash chip design than the traditional NOR flash, with higher density but a handful of characteristics which make it @@ -570,7 +1050,7 @@ config JFFS2_FS_NAND config CRAMFS tristate "Compressed ROM file system support" - ---help--- + help Saying Y here includes support for CramFs (Compressed ROM File System). CramFs is designed to be a simple, small, and compressed file system for ROM based embedded systems. CramFs is read-only, @@ -588,136 +1068,9 @@ config CRAMFS If unsure, say N. -config TMPFS - bool "Virtual memory file system support (former shm fs)" - help - Tmpfs is a file system which keeps all files in virtual memory. - - Everything in tmpfs is temporary in the sense that no files will be - created on your hard drive. The files live in memory and swap - space. If you unmount a tmpfs instance, everything stored therein is - lost. - - See for details. - -config RAMFS - bool - default y - ---help--- - Ramfs is a file system which keeps all files in RAM. It allows - read and write access. - - It is more of an programming example than a useable file system. If - you need a file system which lives in RAM with limit checking use - tmpfs. - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called ramfs. - -config HUGETLBFS - bool "HugeTLB file system support" - depends on HUGETLB_PAGE - -config ISO9660_FS - tristate "ISO 9660 CDROM file system support" - ---help--- - This is the standard file system used on CD-ROMs. It was previously - known as "High Sierra File System" and is called "hsfs" on other - Unix systems. The so-called Rock-Ridge extensions which allow for - long Unix filenames and symbolic links are also supported by this - driver. If you have a CD-ROM drive and want to do more with it than - just listen to audio CDs and watch its LEDs, say Y (and read - and the CD-ROM-HOWTO, - available from ), thereby - enlarging your kernel by about 27 KB; otherwise say N. - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called isofs. - -config JOLIET - bool "Microsoft Joliet CDROM extensions" - depends on ISO9660_FS - help - Joliet is a Microsoft extension for the ISO 9660 CD-ROM file system - which allows for long filenames in unicode format (unicode is the - new 16 bit character code, successor to ASCII, which encodes the - characters of almost all languages of the world; see - for more information). Say Y here if you - want to be able to read Joliet CD-ROMs under Linux. - -config ZISOFS - bool "Transparent decompression extension" - depends on ISO9660_FS - help - This is a Linux-specific extension to RockRidge which lets you store - data in compressed form on a CD-ROM and have it transparently - decompressed when the CD-ROM is accessed. See - for the tools - necessary to create such a filesystem. Say Y here if you want to be - able to read such compressed CD-ROMs. - -config JFS_FS - tristate "JFS filesystem support" - help - This is a port of IBM's Journaled Filesystem . More information is - available in the file Documentation/filesystems/jfs.txt. - - If you do not intend to use the JFS filesystem, say N. - -config JFS_POSIX_ACL - bool "JFS POSIX Access Control Lists" - depends on JFS_FS - ---help--- - Posix Access Control Lists (ACLs) support permissions for users and - groups beyond the owner/group/world scheme. - - To learn more about Access Control Lists, visit the Posix ACLs for - Linux website . - - If you don't know what Access Control Lists are, say N - -config JFS_DEBUG - bool "JFS debugging" - depends on JFS_FS - help - If you are experiencing any problems with the JFS filesystem, say - Y here. This will result in additional debugging messages to be - written to the system log. Under normal circumstances, this - results in very little overhead. - -config JFS_STATISTICS - bool "JFS statistics" - depends on JFS_FS - help - Enabling this option will cause statistics from the JFS file system - to be made available to the user in the /proc/fs/jfs/ directory. - -config MINIX_FS - tristate "Minix fs support" - ---help--- - Minix is a simple operating system used in many classes about OS's. - The minix file system (method to organize files on a hard disk - partition or a floppy disk) was the original file system for Linux, - but has been superseded by the second extended file system ext2fs. - You don't want to use the minix file system on your hard disk - because of certain built-in restrictions, but it is sometimes found - on older Linux floppy disks. This option will enlarge your kernel - by about 28 KB. If unsure, say N. - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called minix. Note that the file system of your root - partition (the one containing the directory /) cannot be compiled as - a module. - config VXFS_FS tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" - ---help--- + help FreeVxFS is a file system driver that support the VERITAS VxFS(TM) file system format. VERITAS VxFS(TM) is the standard file system of SCO UnixWare (and possibly others) and optionally available @@ -731,173 +1084,32 @@ config VXFS_FS This file system is also available as a module ( = code which can be inserted in and removed from the running kernel whenever you want). The module is called freevxfs. If you want to compile it as a - module, say M here and read . If - unsure, say N. - -config NTFS_FS - tristate "NTFS file system support (read only)" - ---help--- - NTFS is the file system of Microsoft Windows NT/2000/XP. For more - information see . Saying Y - here would allow you to read from NTFS partitions. - - This file system is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called ntfs. If you want to compile it as a - module, say M here and read . - - If you are not using Windows NT/2000/XP in addition to Linux on your - computer it is safe to say N. - -config NTFS_DEBUG - bool "NTFS debugging support" - depends on NTFS_FS - ---help--- - If you are experiencing any problems with the NTFS file system, say - Y here. This will result in additional consistency checks to be - performed by the driver as well as additional debugging messages to - be written to the system log. Note that debugging messages are - disabled by default. To enable them, supply the option debug_msgs=1 - at the kernel command line when booting the kernel or as an option - to insmod when loading the ntfs module. Once the driver is active, - you can enable debugging messages by doing (as root): - echo 1 > /proc/sys/fs/ntfs-debug - Replacing the "1" with "0" would disable debug messages. - - If you leave debugging messages disabled, this results in little - overhead, but enabling debug messages results in very significant - slowdown of the system. - - When reporting bugs, please try to have available a full dump of - debugging messages while the misbehaviour was occurring. - -config NTFS_RW - bool "NTFS write support (DANGEROUS)" - depends on NTFS_FS && EXPERIMENTAL - help - This enables the experimental write support in the NTFS driver. - - WARNING: Do not use this option unless you are actively developing - NTFS as it is currently guaranteed to be broken and you - may lose all your data! - - It is strongly recommended and perfectly safe to say N here. - -config HPFS_FS - tristate "OS/2 HPFS file system support" - ---help--- - OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS - is the file system used for organizing files on OS/2 hard disk - partitions. Say Y if you want to be able to read files from and - write files to an OS/2 HPFS partition on your hard drive. OS/2 - floppies however are in regular MSDOS format, so you don't need this - option in order to be able to read them. Read - . - - This file system is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module is called hpfs. If you want to compile it as a module, - say M here and read . If unsure, - say N. - -config PROC_FS - bool "/proc file system support" - ---help--- - This is a virtual file system providing information about the status - of the system. "Virtual" means that it doesn't take up any space on - your hard disk: the files are created on the fly by the kernel when - you try to access them. Also, you cannot read the files with older - version of the program less: you need to use more or cat. - - It's totally cool; for example, "cat /proc/interrupts" gives - information about what the different IRQs are used for at the moment - (there is a small number of Interrupt ReQuest lines in your computer - that are used by the attached devices to gain the CPU's attention -- - often a source of trouble if two devices are mistakenly configured - to use the same IRQ). The program procinfo to display some - information about your system gathered from the /proc file system. - - Before you can use the /proc file system, it has to be mounted, - meaning it has to be given a location in the directory hierarchy. - That location should be /proc. A command such as "mount -t proc proc - /proc" or the equivalent line in /etc/fstab does the job. - - The /proc file system is explained in the file - and on the proc(5) manpage - ("man 5 proc"). - - This option will enlarge your kernel by about 67 KB. Several - programs depend on this, so everyone should say Y here. - -config DEVFS_FS - bool "/dev file system support (EXPERIMENTAL)" - depends on EXPERIMENTAL - ---help--- - This is support for devfs, a virtual file system (like /proc) which - provides the file system interface to device drivers, normally found - in /dev. Devfs does not depend on major and minor number - allocations. Device drivers register entries in /dev which then - appear automatically, which means that the system administrator does - not have to create character and block special device files in the - /dev directory using the mknod command (or MAKEDEV script) anymore. - - This is work in progress. If you want to use this, you *must* read - the material in , especially - the file README there. - - If unsure, say N. - -config DEVFS_MOUNT - bool "Automatically mount at boot" - depends on DEVFS_FS - help - This option appears if you have CONFIG_DEVFS_FS enabled. Setting - this to 'Y' will make the kernel automatically mount devfs onto /dev - when the system is booted, before the init thread is started. - You can override this with the "devfs=nomount" boot option. + module, say M here and read . If + unsure, say N. - If unsure, say N. -config DEVFS_DEBUG - bool "Debug devfs" - depends on DEVFS_FS +config HPFS_FS + tristate "OS/2 HPFS file system support" help - If you say Y here, then the /dev file system code will generate - debugging messages. See the file - for more - details. - - If unsure, say N. + OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS + is the file system used for organizing files on OS/2 hard disk + partitions. Say Y if you want to be able to read files from and + write files to an OS/2 HPFS partition on your hard drive. OS/2 + floppies however are in regular MSDOS format, so you don't need this + option in order to be able to read them. Read + . -# It compiles as a module for testing only. It should not be used -# as a module in general. If we make this "tristate", a bunch of people -# who don't know what they are doing turn it on and complain when it -# breaks. -config DEVPTS_FS - bool "/dev/pts file system for Unix98 PTYs" - depends on UNIX98_PTYS - ---help--- - You should say Y here if you said Y to "Unix98 PTY support" above. - You'll then get a virtual file system which can be mounted on - /dev/pts with "mount -t devpts". This, together with the pseudo - terminal master multiplexer /dev/ptmx, is used for pseudo terminal - support as described in The Open Group's Unix98 standard: in order - to acquire a pseudo terminal, a process opens /dev/ptmx; the number - of the pseudo terminal is then made available to the process and the - pseudo terminal slave can be accessed as /dev/pts/. What was - traditionally /dev/ttyp2 will then be /dev/pts/2, for example. + This file system is also available as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module is called hpfs. If you want to compile it as a module, + say M here and read . If unsure, + say N. - The GNU C library glibc 2.1 contains the requisite support for this - mode of operation; you also need client programs that use the Unix98 - API. Please read for more information - about the Unix98 pty devices. - Note that the experimental "/dev file system support" - (CONFIG_DEVFS_FS) is a more general facility. config QNX4FS_FS tristate "QNX4 file system support (read only)" - ---help--- + help This is the file system used by the real-time operating systems QNX 4 and QNX 6 (the latter is also called QNX RTP). Further information is available at . @@ -923,97 +1135,11 @@ config QNX4FS_RW It's currently broken, so for now: answer N. -config ROMFS_FS - tristate "ROM file system support" - ---help--- - This is a very small read-only file system mainly intended for - initial ram disks of installation disks, but it could be used for - other read-only media as well. Read - for details. - - This file system support is also available as a module ( = code - which can be inserted in and removed from the running kernel - whenever you want). The module is called romfs. If you want to - compile it as a module, say M here and read - . Note that the file system of your - root partition (the one containing the directory /) cannot be a - module. - - If you don't know whether you need it, then you don't need it: - answer N. - -config EXT2_FS - tristate "Second extended fs support" - ---help--- - This is the de facto standard Linux file system (method to organize - files on a storage device) for hard disks. - - You want to say Y here, unless you intend to use Linux exclusively - from inside a DOS partition using the UMSDOS file system. The - advantage of the latter is that you can get away without - repartitioning your hard drive (which often implies backing - everything up and restoring afterwards); the disadvantage is that - Linux becomes susceptible to DOS viruses and that UMSDOS is somewhat - slower than ext2fs. Even if you want to run Linux in this fashion, - it might be a good idea to have ext2fs around: it enables you to - read more floppy disks and facilitates the transition to a *real* - Linux partition later. Another (rare) case which doesn't require - ext2fs is a diskless Linux box which mounts all files over the - network using NFS (in this case it's sufficient to say Y to "NFS - file system support" below). Saying Y here will enlarge your kernel - by about 44 KB. - - The Ext2fs-Undeletion mini-HOWTO, available from - , gives information about - how to retrieve deleted files on ext2fs file systems. - - To change the behavior of ext2 file systems, you can use the tune2fs - utility ("man tune2fs"). To modify attributes of files and - directories on ext2 file systems, use chattr ("man chattr"). - - Ext2fs partitions can be read from within DOS using the ext2tool - command line tool package (available from - ) and from - within Windows NT using the ext2nt command line tool package from - . Explore2fs is a - graphical explorer for ext2fs partitions which runs on Windows 95 - and Windows NT and includes experimental write support; it is - available from - . - - If you want to compile this file system as a module ( = code which - can be inserted in and removed from the running kernel whenever you - want), say M here and read . The - module will be called ext2. Be aware however that the file system - of your root partition (the one containing the directory /) cannot - be compiled as a module, and so this could be dangerous. Most - everyone wants to say Y here. - -config EXT2_FS_XATTR - bool "Ext2 extended attributes" - depends on EXT2_FS - ---help--- - Extended attributes are name:value pairs associated with inodes by - the kernel or by users (see the attr(5) manual page, or visit - for details). - - If unsure, say N. - -config EXT2_FS_POSIX_ACL - bool "Ext2 POSIX Access Control Lists" - depends on EXT2_FS_XATTR - ---help--- - Posix Access Control Lists (ACLs) support permissions for users and - groups beyond the owner/group/world scheme. - - To learn more about Access Control Lists, visit the Posix ACLs for - Linux website . - If you don't know what Access Control Lists are, say N config SYSV_FS tristate "System V/Xenix/V7/Coherent file system support" - ---help--- + help SCO, Xenix and Coherent are commercial Unix systems for Intel machines, and Version 7 was used on the DEC PDP-11. Saying Y here would allow you to read from their floppies and hard disk @@ -1049,172 +1175,55 @@ config SYSV_FS If you haven't heard about all of this before, it's safe to say N. -config UDF_FS - tristate "UDF file system support" - ---help--- - This is the new file system used on some CD-ROMs and DVDs. Say Y if - you intend to mount DVD discs or CDRW's written in packet mode, or - if written to by other UDF utilities, such as DirectCD. - Please read . - - This file system support is also available as a module ( = code - which can be inserted in and removed from the running kernel - whenever you want). The module is called udf. If you want to - compile it as a module, say M here and read - . - If unsure, say N. config UFS_FS tristate "UFS file system support (read only)" - ---help--- - BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, - OpenBSD and NeXTstep) use a file system called UFS. Some System V - Unixes can create and mount hard disk partitions and diskettes using - this file system as well. Saying Y here will allow you to read from - these partitions; if you also want to write to them, say Y to the - experimental "UFS file system write support", below. Please read the - file for more information. - - If you only intend to mount files from some other Unix over the - network using NFS, you don't need the UFS file system support (but - you need NFS file system support obviously). - - Note that this option is generally not needed for floppies, since a - good portable way to transport files and directories between unixes - (and even other operating systems) is given by the tar program ("man - tar" or preferably "info tar"). - - When accessing NeXTstep files, you may need to convert them from the - NeXT character set to the Latin1 character set; use the program - recode ("info recode") for this purpose. - - If you want to compile the UFS file system support as a module ( = - code which can be inserted in and removed from the running kernel - whenever you want), say M here and read - . The module will be called ufs. - - If you haven't heard about all of this before, it's safe to say N. - -config UFS_FS_WRITE - bool "UFS file system write support (DANGEROUS)" - depends on UFS_FS && EXPERIMENTAL help - Say Y here if you want to try writing to UFS partitions. This is - experimental, so you should back up your UFS partitions beforehand. - -config XFS_FS - tristate "XFS filesystem support" - ---help--- - XFS is a high performance journaling filesystem which originated - on the SGI IRIX platform. It is completely multi-threaded, can - support large files and large filesystems, extended attributes, - variable block sizes, is extent based, and makes extensive use of - Btrees (directories, extents, free space) to aid both performance - and scalability. - - Refer to the documentation at - for complete details. This implementation is on-disk compatible - with the IRIX version of XFS. - - If you want to compile this file system as a module ( = code which - can be inserted in and removed from the running kernel whenever you - want), say M here and read . The - module will be called xfs. Be aware, however, that if the file - system of your root partition is compiled as a module, you'll need - to use an initial ramdisk (initrd) to boot. - -config XFS_RT - bool "Realtime support (EXPERIMENTAL)" - depends on XFS_FS && EXPERIMENTAL - ---help--- - If you say Y here you will be able to mount and use XFS filesystems - which contain a realtime subvolume. The realtime subvolume is a - separate area of disk space where only file data is stored. The - realtime subvolume is designed to provide very deterministic - data rates suitable for media streaming applications. - - See the xfs man page in section 5 for a bit more information. - - This feature is unsupported at this time, is not yet fully - functional, and may cause serious problems. - - If unsure, say N. - -config XFS_QUOTA - bool "Quota support" - depends on XFS_FS - ---help--- - If you say Y here, you will be able to set limits for disk usage on - a per user and/or a per group basis under XFS. XFS considers quota - information as filesystem metadata and uses journaling to provide a - higher level guarantee of consistency. The on-disk data format for - quota is also compatible with the IRIX version of XFS, allowing a - filesystem to be migrated between Linux and IRIX without any need - for conversion. - - If unsure, say N. More comprehensive documentation can be found in - README.quota in the xfsprogs package. XFS quota can be used either - with or without the generic quota support enabled (CONFIG_QUOTA) - - they are completely independent subsystems. - -config XFS_POSIX_ACL - bool "ACL support" - depends on XFS_FS - ---help--- - Posix Access Control Lists (ACLs) support permissions for users and - groups beyond the owner/group/world scheme. - - To learn more about Access Control Lists, visit the Posix ACLs for - Linux website . - - If you don't know what Access Control Lists are, say N - + BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, + OpenBSD and NeXTstep) use a file system called UFS. Some System V + Unixes can create and mount hard disk partitions and diskettes using + this file system as well. Saying Y here will allow you to read from + these partitions; if you also want to write to them, say Y to the + experimental "UFS file system write support", below. Please read the + file for more information. -menu "Network File Systems" - depends on NET + If you only intend to mount files from some other Unix over the + network using NFS, you don't need the UFS file system support (but + you need NFS file system support obviously). -config CODA_FS - tristate "Coda file system support (advanced network fs)" - depends on INET - ---help--- - Coda is an advanced network file system, similar to NFS in that it - enables you to mount file systems of a remote server and access them - with regular Unix commands as if they were sitting on your hard - disk. Coda has several advantages over NFS: support for - disconnected operation (e.g. for laptops), read/write server - replication, security model for authentication and encryption, - persistent client caches and write back caching. + Note that this option is generally not needed for floppies, since a + good portable way to transport files and directories between unixes + (and even other operating systems) is given by the tar program ("man + tar" or preferably "info tar"). - If you say Y here, your Linux box will be able to act as a Coda - *client*. You will need user level code as well, both for the - client and server. Servers are currently user level, i.e. they need - no kernel support. Please read - and check out the Coda - home page . + When accessing NeXTstep files, you may need to convert them from the + NeXT character set to the Latin1 character set; use the program + recode ("info recode") for this purpose. - If you want to compile the coda client support as a module ( = code - which can be inserted in and removed from the running kernel + If you want to compile the UFS file system support as a module ( = + code which can be inserted in and removed from the running kernel whenever you want), say M here and read - . The module will be called coda. + . The module will be called ufs. -config INTERMEZZO_FS - tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)" - depends on INET && EXPERIMENTAL + If you haven't heard about all of this before, it's safe to say N. + +config UFS_FS_WRITE + bool "UFS file system write support (DANGEROUS)" + depends on UFS_FS && EXPERIMENTAL help - InterMezzo is a networked file system with disconnected operation - and kernel level write back caching. It is most often used for - replicating potentially large trees or keeping laptop/desktop copies - in sync. + Say Y here if you want to try writing to UFS partitions. This is + experimental, so you should back up your UFS partitions beforehand. - If you say Y or M your kernel or module will provide InterMezzo - support. You will also need a file server daemon, which you can get - from . +endmenu + +menu "Network File Systems" + depends on NET config NFS_FS tristate "NFS file system support" depends on INET - ---help--- + help If you are connected to some other (usually local) Unix computer (using SLIP, PLIP, PPP or Ethernet) and want to mount files residing on that computer (the NFS server) using the Network File Sharing @@ -1268,24 +1277,10 @@ config NFS_V4 If unsure, say N. -config ROOT_NFS - bool "Root file system on NFS" - depends on NFS_FS=y && IP_PNP - help - If you want your Linux box to mount its whole root file system (the - one containing the directory /) from some other computer over the - net via NFS (presumably because your box doesn't have a hard disk), - say Y. Read for details. It is - likely that in this case, you also want to say Y to "Kernel level IP - autoconfiguration" so that your box can discover its network address - at boot time. - - Most people say N here. - config NFSD tristate "NFS server support" depends on INET - ---help--- + help If you want your Linux box to act as an NFS *server*, so that other computers on your local network which support NFS can access certain directories on your box transparently, you have two options: you can @@ -1334,34 +1329,19 @@ config NFSD_TCP Enable NFS service over TCP connections. This the officially still experimental, but seems to work well. -config SUNRPC - tristate - default m if NFS_FS!=y && NFSD!=y && (NFS_FS=m || NFSD=m) - default y if NFS_FS=y || NFSD=y - -config SUNRPC_GSS - tristate "Provide RPCSEC_GSS authentication (EXPERIMENTAL)" - depends on SUNRPC && EXPERIMENTAL - default SUNRPC if NFS_V4=y - help - Provides cryptographic authentication for NFS rpc requests. To - make this useful, you must also select at least one rpcsec_gss - mechanism. - Note: You should always select this option if you wish to use - NFSv4. - -config RPCSEC_GSS_KRB5 - tristate "Kerberos V mechanism for RPCSEC_GSS (EXPERIMENTAL)" - depends on SUNRPC_GSS && CRYPTO_DES && CRYPTO_MD5 - default SUNRPC_GSS if NFS_V4=y +config ROOT_NFS + bool "Root file system on NFS" + depends on NFS_FS=y && IP_PNP help - Provides a gss-api mechanism based on Kerberos V5 (this is - mandatory for RFC3010-compliant NFSv4 implementations). - Requires a userspace daemon; - see http://www.citi.umich.edu/projects/nfsv4/. + If you want your Linux box to mount its whole root file system (the + one containing the directory /) from some other computer over the + net via NFS (presumably because your box doesn't have a hard disk), + say Y. Read for details. It is + likely that in this case, you also want to say Y to "Kernel level IP + autoconfiguration" so that your box can discover its network address + at boot time. - Note: If you select this option, please ensure that you also - enable the MD5 and DES crypto ciphers. + Most people say N here. config LOCKD tristate @@ -1377,32 +1357,10 @@ config EXPORTFS tristate default NFSD -config CIFS - tristate "CIFS support (advanced network filesystem for Samba, Window and other CIFS compliant servers)(EXPERIMENTAL)" - depends on INET - ---help--- - This is the client VFS module for the Common Internet File System - (CIFS) protocol which is the successor to the Server Message Block - (SMB) protocol, the native file sharing mechanism for most early - PC operating systems. CIFS is fully supported by current network - file servers such as Windows 2000 (including Windows NT version 4 - and Windows XP) as well by Samba (which provides excellent CIFS - server support for Linux and many other operating systems). For - production systems the smbfs module may be used instead of this - cifs module since smbfs is currently more stable and provides - support for older servers. The intent of this module is to provide the - most advanced network file system function for CIFS compliant servers, - including support for dfs (heirarchical name space), secure per-user - session establishment, safe distributed caching (oplock), optional - packet signing, Unicode and other internationalization improvements, and - optional Winbind (nsswitch) integration. This module is in an early - development stage, so unless you are specifically interested in this - filesystem, just say N. - config SMB_FS tristate "SMB file system support (to mount Windows shares etc.)" depends on INET - ---help--- + help SMB (Server Message Block) is the protocol Windows for Workgroups (WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share files and printers over local networks. Saying Y here allows you to @@ -1456,10 +1414,32 @@ config SMB_NLS_REMOTE smbmount from samba 2.2.0 or later supports this. +config CIFS + tristate "CIFS support (advanced network filesystem for Samba, Window and other CIFS compliant servers)(EXPERIMENTAL)" + depends on INET + help + This is the client VFS module for the Common Internet File System + (CIFS) protocol which is the successor to the Server Message Block + (SMB) protocol, the native file sharing mechanism for most early + PC operating systems. CIFS is fully supported by current network + file servers such as Windows 2000 (including Windows NT version 4 + and Windows XP) as well by Samba (which provides excellent CIFS + server support for Linux and many other operating systems). For + production systems the smbfs module may be used instead of this + cifs module since smbfs is currently more stable and provides + support for older servers. The intent of this module is to provide the + most advanced network file system function for CIFS compliant servers, + including support for dfs (heirarchical name space), secure per-user + session establishment, safe distributed caching (oplock), optional + packet signing, Unicode and other internationalization improvements, and + optional Winbind (nsswitch) integration. This module is in an early + development stage, so unless you are specifically interested in this + filesystem, just say N. + config NCP_FS tristate "NCP file system support (to mount NetWare volumes)" depends on IPX!=n || INET - ---help--- + help NCP (NetWare Core Protocol) is a protocol that runs over IPX and is used by Novell NetWare clients to talk to file servers. It is to IPX what NFS is to TCP/IP, if that helps. Saying Y here allows you @@ -1480,10 +1460,76 @@ config NCP_FS will be called ncpfs. Say N unless you are connected to a Novell network. +config CODA_FS + tristate "Coda file system support (advanced network fs)" + depends on INET + help + Coda is an advanced network file system, similar to NFS in that it + enables you to mount file systems of a remote server and access them + with regular Unix commands as if they were sitting on your hard + disk. Coda has several advantages over NFS: support for + disconnected operation (e.g. for laptops), read/write server + replication, security model for authentication and encryption, + persistent client caches and write back caching. + + If you say Y here, your Linux box will be able to act as a Coda + *client*. You will need user level code as well, both for the + client and server. Servers are currently user level, i.e. they need + no kernel support. Please read + and check out the Coda + home page . + + If you want to compile the coda client support as a module ( = code + which can be inserted in and removed from the running kernel + whenever you want), say M here and read + . The module will be called coda. + +config INTERMEZZO_FS + tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)" + 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 + replicating potentially large trees or keeping laptop/desktop copies + in sync. + + If you say Y or M your kernel or module will provide InterMezzo + support. You will also need a file server daemon, which you can get + from . + +config SUNRPC + tristate + default m if NFS_FS!=y && NFSD!=y && (NFS_FS=m || NFSD=m) + default y if NFS_FS=y || NFSD=y + +config SUNRPC_GSS + tristate "Provide RPCSEC_GSS authentication (EXPERIMENTAL)" + depends on SUNRPC && EXPERIMENTAL + default SUNRPC if NFS_V4=y + help + Provides cryptographic authentication for NFS rpc requests. To + make this useful, you must also select at least one rpcsec_gss + mechanism. + Note: You should always select this option if you wish to use + NFSv4. + +config RPCSEC_GSS_KRB5 + tristate "Kerberos V mechanism for RPCSEC_GSS (EXPERIMENTAL)" + depends on SUNRPC_GSS && CRYPTO_DES && CRYPTO_MD5 + default SUNRPC_GSS if NFS_V4=y + help + Provides a gss-api mechanism based on Kerberos V5 (this is + mandatory for RFC3010-compliant NFSv4 implementations). + Requires a userspace daemon; + see http://www.citi.umich.edu/projects/nfsv4/. + + Note: If you select this option, please ensure that you also + enable the MD5 and DES crypto ciphers. + source "fs/ncpfs/Kconfig" -# for fs/nls/Config.in config AFS_FS +# for fs/nls/Config.in tristate "Andrew File System support (AFS) (Experimental)" depends on INET && EXPERIMENTAL help @@ -1501,29 +1547,6 @@ config RXRPC endmenu -# for fs/nls/Config.in -config ZISOFS_FS - tristate - depends on ZISOFS - default ISO9660_FS - -# Meta block cache for Extended Attributes (ext2/ext3) -config FS_MBCACHE - tristate - depends on EXT2_FS_XATTR || EXT3_FS_XATTR - default y if EXT2_FS=y || EXT3_FS=y - default m if EXT2_FS=m || EXT3_FS=m - -# Posix ACL utility routines (for now, only ext2/ext3/jfs) -# -# NOTE: you can implement Posix ACLs without these helpers (XFS does). -# Never use this symbol for ifdefs. -# -config FS_POSIX_ACL - bool - depends on EXT2_FS_POSIX_ACL || EXT3_FS_POSIX_ACL || JFS_POSIX_ACL - default y - menu "Partition Types" source "fs/partitions/Kconfig" -- cgit v1.2.3 From bda2dabecfce94ecbcf155e7a4563b1004933100 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sat, 15 Mar 2003 01:19:40 -0800 Subject: [PATCH] typos only No code changes; still builds OK. --- fs/seq_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/seq_file.c b/fs/seq_file.c index 7d2b18a7bfe4..ba4d28168e01 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -1,7 +1,7 @@ /* * linux/fs/seq_file.c * - * helper functions for making syntetic files from sequences of records. + * helper functions for making synthetic files from sequences of records. * initial implementation -- AV, Oct 2001. */ @@ -215,7 +215,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) while ((retval=traverse(m, offset)) == -EAGAIN) ; if (retval) { - /* with extreme perjudice... */ + /* with extreme prejudice... */ file->f_pos = 0; m->index = 0; m->count = 0; -- cgit v1.2.3 From 4450913a6ad81d5c815c25d3c8a0be63fa30a0ef Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sun, 16 Mar 2003 05:46:08 -0800 Subject: [PATCH] fsmenu update As requested by Andrew, this moves the hugetlbfs config option into the Pseudo filesystems section near tmpfs. --- fs/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs') diff --git a/fs/Kconfig b/fs/Kconfig index 4d207c254079..3326d8daedcc 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -377,10 +377,6 @@ config ROMFS_FS If you don't know whether you need it, then you don't need it: answer N. -config HUGETLBFS - bool "HugeTLB file system support" - depends on HUGETLB_PAGE - config QUOTA bool "Quota support" help @@ -819,6 +815,10 @@ config TMPFS See for details. +config HUGETLBFS + bool "HugeTLB file system support" + depends on HUGETLB_PAGE + config RAMFS bool default y -- cgit v1.2.3 From 538316d27a4aa60975b9ba0f7b29668504b2cae3 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 16 Mar 2003 07:22:09 -0800 Subject: [PATCH] fix devfs oops The recent (untested?) "cleanup" removed a null-pointer test. --- fs/devfs/base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/devfs/base.c b/fs/devfs/base.c index c87c23f3fa01..9cefcfa5b8a7 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c @@ -1802,8 +1802,11 @@ int devfs_generate_path (devfs_handle_t de, char *path, int buflen) static struct file_operations *devfs_get_ops (devfs_handle_t de) { struct file_operations *ops = de->u.cdev.ops; - struct module *owner = ops->owner; + struct module *owner; + if (!ops) + return NULL; + owner = ops->owner; read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */ if ( (de->next == de) || !try_module_get (owner) ) { /* Entry is already unhooked or module is unloading */ -- cgit v1.2.3 From 3bdfab20fc8add21074bfa24c1a6384ae4eda35d Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 16 Mar 2003 07:22:47 -0800 Subject: [PATCH] Ext2/3 noatime and dirsync fixes Patch from "Theodore Ts'o" I recently noticed a bug in ext2/3; newly created inodes which inherit the noatime flag from their containing directory do not respect noatime until the inode is flushed from the inode cache and then re-read later. This is because the code which checks the ext2 no-atime attribute and then sets the S_NOATIME in inode->i_flags is present in ext2_read_inode(), but not in ext2_new_inode(). I fixed this in 2.4, and then found an even worse bug in the 2.5 code; the DIRSYNC flag is completely ignored *except* in the case where a directory is newly created using mkdir and its parent directory has the DIRSYNC flag. S_DIRSYNC doesn't get set in the ext2_new_inode() or the ext2_ioctl() paths (which is used by chattr). This patch centralizes the code which translates the ext2 flags in the raw ext2 inode to the appropriate flag values in inode->i_flags in a single location. This fixes the bug, makes things cleaner, and also removes 30 lines of code and 128 bytes of compiled x86 text in the bargain. --- fs/ext2/ext2.h | 1 + fs/ext2/ialloc.c | 5 +---- fs/ext2/inode.c | 26 ++++++++++++++++++-------- fs/ext2/ioctl.c | 17 +---------------- fs/ext3/ialloc.c | 5 +---- fs/ext3/inode.c | 27 +++++++++++++++++++-------- fs/ext3/ioctl.c | 17 +---------------- include/linux/ext3_fs.h | 1 + 8 files changed, 43 insertions(+), 56 deletions(-) (limited to 'fs') diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 7850dcbe7bf1..610695289845 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -112,6 +112,7 @@ extern int ext2_sync_inode (struct inode *); extern void ext2_discard_prealloc (struct inode *); extern void ext2_truncate (struct inode *); extern int ext2_setattr (struct dentry *, struct iattr *); +extern void ext2_set_inode_flags(struct inode *inode); /* ioctl.c */ extern int ext2_ioctl (struct inode *, struct file *, unsigned int, diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 345e7495176d..87b2d99f4a7c 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -545,10 +545,7 @@ repeat: ei->i_prealloc_count = 0; ei->i_dir_start_lookup = 0; ei->i_state = EXT2_STATE_NEW; - if (ei->i_flags & EXT2_SYNC_FL) - inode->i_flags |= S_SYNC; - if (ei->i_flags & EXT2_DIRSYNC_FL) - inode->i_flags |= S_DIRSYNC; + ext2_set_inode_flags(inode); inode->i_generation = EXT2_SB(sb)->s_next_generation++; insert_inode_hash(inode); diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index e47f84e305cd..c2fbefdd3613 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -1011,6 +1011,23 @@ Egdp: return ERR_PTR(-EIO); } +void ext2_set_inode_flags(struct inode *inode) +{ + unsigned int flags = EXT2_I(inode)->i_flags; + + inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); + if (flags & EXT2_SYNC_FL) + inode->i_flags |= S_SYNC; + if (flags & EXT2_APPEND_FL) + inode->i_flags |= S_APPEND; + if (flags & EXT2_IMMUTABLE_FL) + inode->i_flags |= S_IMMUTABLE; + if (flags & EXT2_NOATIME_FL) + inode->i_flags |= S_NOATIME; + if (flags & EXT2_DIRSYNC_FL) + inode->i_flags |= S_DIRSYNC; +} + void ext2_read_inode (struct inode * inode) { struct ext2_inode_info *ei = EXT2_I(inode); @@ -1108,14 +1125,7 @@ void ext2_read_inode (struct inode * inode) le32_to_cpu(raw_inode->i_block[0])); } brelse (bh); - if (ei->i_flags & EXT2_SYNC_FL) - inode->i_flags |= S_SYNC; - if (ei->i_flags & EXT2_APPEND_FL) - inode->i_flags |= S_APPEND; - if (ei->i_flags & EXT2_IMMUTABLE_FL) - inode->i_flags |= S_IMMUTABLE; - if (ei->i_flags & EXT2_NOATIME_FL) - inode->i_flags |= S_NOATIME; + ext2_set_inode_flags(inode); return; bad_inode: diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index afff8566f3b6..101055bbf519 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c @@ -58,22 +58,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; ei->i_flags = flags; - if (flags & EXT2_SYNC_FL) - inode->i_flags |= S_SYNC; - else - inode->i_flags &= ~S_SYNC; - if (flags & EXT2_APPEND_FL) - inode->i_flags |= S_APPEND; - else - inode->i_flags &= ~S_APPEND; - if (flags & EXT2_IMMUTABLE_FL) - inode->i_flags |= S_IMMUTABLE; - else - inode->i_flags &= ~S_IMMUTABLE; - if (flags & EXT2_NOATIME_FL) - inode->i_flags |= S_NOATIME; - else - inode->i_flags &= ~S_NOATIME; + ext2_set_inode_flags(inode); inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); return 0; diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 228fa402af19..155c19c4ac92 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c @@ -568,10 +568,7 @@ repeat: #endif ei->i_block_group = group; - if (ei->i_flags & EXT3_SYNC_FL) - inode->i_flags |= S_SYNC; - if (ei->i_flags & EXT3_DIRSYNC_FL) - inode->i_flags |= S_DIRSYNC; + ext3_set_inode_flags(inode); if (IS_DIRSYNC(inode)) handle->h_sync = 1; insert_inode_hash(inode); diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index b37c23fb3d5a..5012c1719ee4 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -2209,6 +2209,24 @@ int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc) return -EIO; } +void ext3_set_inode_flags(struct inode *inode) +{ + unsigned int flags = EXT3_I(inode)->i_flags; + + inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); + if (flags & EXT3_SYNC_FL) + inode->i_flags |= S_SYNC; + if (flags & EXT3_APPEND_FL) + inode->i_flags |= S_APPEND; + if (flags & EXT3_IMMUTABLE_FL) + inode->i_flags |= S_IMMUTABLE; + if (flags & EXT3_NOATIME_FL) + inode->i_flags |= S_NOATIME; + if (flags & EXT3_DIRSYNC_FL) + inode->i_flags |= S_DIRSYNC; +} + + void ext3_read_inode(struct inode * inode) { struct ext3_iloc iloc; @@ -2320,14 +2338,7 @@ void ext3_read_inode(struct inode * inode) init_special_inode(inode, inode->i_mode, le32_to_cpu(iloc.raw_inode->i_block[0])); } - if (ei->i_flags & EXT3_SYNC_FL) - inode->i_flags |= S_SYNC; - if (ei->i_flags & EXT3_APPEND_FL) - inode->i_flags |= S_APPEND; - if (ei->i_flags & EXT3_IMMUTABLE_FL) - inode->i_flags |= S_IMMUTABLE; - if (ei->i_flags & EXT3_NOATIME_FL) - inode->i_flags |= S_NOATIME; + ext3_set_inode_flags(inode); return; bad_inode: diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 5d74409cef07..cedf91bde8a2 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c @@ -85,22 +85,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE; ei->i_flags = flags; - if (flags & EXT3_SYNC_FL) - inode->i_flags |= S_SYNC; - else - inode->i_flags &= ~S_SYNC; - if (flags & EXT3_APPEND_FL) - inode->i_flags |= S_APPEND; - else - inode->i_flags &= ~S_APPEND; - if (flags & EXT3_IMMUTABLE_FL) - inode->i_flags |= S_IMMUTABLE; - else - inode->i_flags &= ~S_IMMUTABLE; - if (flags & EXT3_NOATIME_FL) - inode->i_flags |= S_NOATIME; - else - inode->i_flags &= ~S_NOATIME; + ext3_set_inode_flags(inode); inode->i_ctime = CURRENT_TIME; err = ext3_mark_iloc_dirty(handle, inode, &iloc); diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 0612ce8e8274..b3da32479e13 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h @@ -730,6 +730,7 @@ extern void ext3_discard_prealloc (struct inode *); extern void ext3_dirty_inode(struct inode *); extern int ext3_change_inode_journal_flag(struct inode *, int); extern void ext3_truncate (struct inode *); +extern void ext3_set_inode_flags(struct inode *); /* ioctl.c */ extern int ext3_ioctl (struct inode *, struct file *, unsigned int, -- cgit v1.2.3 From 8262499b5f995de00b23fd55c25c8804dcc02b5e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 16 Mar 2003 07:22:55 -0800 Subject: [PATCH] ext2: block allocation fix Patch from Alex Tomas There is a logic error in ext2_new_block(). If we manage to reserve some blocks in the final blockgroup, local variable `bit' will be equal to sbi->s_groups_count and we erroneously assume that the allocation failed. Fix that up by testing local variable `group_alloc' instead. --- fs/ext2/balloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index e5bee153791a..40868d403f0b 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -395,7 +395,7 @@ int ext2_new_block (struct inode * inode, unsigned long goal, goto io_error; group_alloc = group_reserve_blocks(desc, gdp_bh, es_alloc); } - if (bit >= sbi->s_groups_count) { + if (!group_alloc) { *err = -ENOSPC; goto out_release; } -- cgit v1.2.3 From d4d68172ab0bbdc2ef8c50dbb3aed580b519a2dd Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 16 Mar 2003 07:23:09 -0800 Subject: [PATCH] initialise inode->i_rdev From latest -aa kernels. --- fs/inode.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs') diff --git a/fs/inode.c b/fs/inode.c index 514863d8df82..200d338ad629 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -129,6 +129,7 @@ static struct inode *alloc_inode(struct super_block *sb) inode->i_pipe = NULL; inode->i_bdev = NULL; inode->i_cdev = NULL; + inode->i_rdev = to_kdev_t(0); inode->i_security = NULL; if (security_inode_alloc(inode)) { if (inode->i_sb->s_op->destroy_inode) -- cgit v1.2.3 From e431dd0089591d054b960c80bf9c4fcdb5c4478a Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 16 Mar 2003 07:23:17 -0800 Subject: [PATCH] AFFS fixes Patch from Roman Zippel - remove lock_kernel() (It was buggy too - there are at present two missing unlock_kernel()s) - fixes a bitmap corruption problem. --- fs/affs/Changes | 5 +++++ fs/affs/bitmap.c | 13 ++++++------ fs/affs/dir.c | 3 --- fs/affs/inode.c | 15 +++----------- fs/affs/namei.c | 60 +++++++++---------------------------------------------- fs/affs/super.c | 6 ++---- fs/affs/symlink.c | 4 ---- 7 files changed, 26 insertions(+), 80 deletions(-) (limited to 'fs') diff --git a/fs/affs/Changes b/fs/affs/Changes index ee6308003167..a29409c1ffe0 100644 --- a/fs/affs/Changes +++ b/fs/affs/Changes @@ -28,6 +28,11 @@ Known bugs: Please direct bug reports to: zippel@linux-m68k.org +Version 3.20 +------------ +- kill kernel lock +- fix for a possible bitmap corruption + Version 3.19 ------------ diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index d1792538c26a..095ef77a407e 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c @@ -185,6 +185,8 @@ find_bmap: /* search for the next bmap buffer with free bits */ i = sbi->s_bmap_count; do { + if (--i < 0) + goto err_full; bmap++; bm++; if (bmap < sbi->s_bmap_count) @@ -192,8 +194,6 @@ find_bmap: /* restart search at zero */ bmap = 0; bm = sbi->s_bitmap; - if (--i <= 0) - goto err_full; } while (!bm->bm_free); blk = bmap * sbi->s_bmap_bits; @@ -216,8 +216,8 @@ find_bmap_bit: mask = ~0UL << (bit & 31); blk &= ~31UL; - tmp = be32_to_cpu(*data) & mask; - if (tmp) + tmp = be32_to_cpu(*data); + if (tmp & mask) goto find_bit; /* scan the rest of the buffer */ @@ -230,10 +230,11 @@ find_bmap_bit: goto find_bmap; } while (!(tmp = *data)); tmp = be32_to_cpu(tmp); + mask = ~0; find_bit: /* finally look for a free bit in the word */ - bit = ffs(tmp) - 1; + bit = ffs(tmp & mask) - 1; blk += bit + sbi->s_reserved; mask2 = mask = 1 << (bit & 31); AFFS_I(inode)->i_lastalloc = blk; @@ -266,8 +267,8 @@ err_bh_read: sbi->s_bmap_bh = NULL; sbi->s_last_bmap = ~0; err_full: - pr_debug("failed\n"); up(&sbi->s_bmlock); + pr_debug("failed\n"); return 0; } diff --git a/fs/affs/dir.c b/fs/affs/dir.c index f7fa4f8ddb71..3fc41d17359d 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c @@ -65,8 +65,6 @@ affs_readdir(struct file *filp, void *dirent, filldir_t filldir) int stored; int res; - lock_kernel(); - pr_debug("AFFS: readdir(ino=%lu,f_pos=%lx)\n",inode->i_ino,(unsigned long)filp->f_pos); stored = 0; @@ -162,7 +160,6 @@ readdir_out: affs_brelse(dir_bh); affs_brelse(fh_bh); affs_unlock_dir(inode); - unlock_kernel(); pr_debug("AFFS: readdir()=%d\n", stored); return res; } diff --git a/fs/affs/inode.c b/fs/affs/inode.c index f109be30c624..37aca8f801fd 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -195,11 +195,9 @@ affs_write_inode(struct inode *inode, int unused) if (!inode->i_nlink) // possibly free block return; - lock_kernel(); bh = affs_bread(sb, inode->i_ino); if (!bh) { affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino); - unlock_kernel(); return; } tail = AFFS_TAIL(sb, bh); @@ -227,7 +225,7 @@ affs_write_inode(struct inode *inode, int unused) affs_fix_checksum(sb, bh); mark_buffer_dirty_inode(bh, inode); affs_brelse(bh); - unlock_kernel(); + affs_free_prealloc(inode); } int @@ -236,8 +234,6 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) struct inode *inode = dentry->d_inode; int error; - lock_kernel(); - pr_debug("AFFS: notify_change(%lu,0x%x)\n",inode->i_ino,attr->ia_valid); error = inode_change_ok(inode,attr); @@ -257,7 +253,6 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) if (!error && (attr->ia_valid & ATTR_MODE)) mode_to_prot(inode); out: - unlock_kernel(); return error; } @@ -265,15 +260,13 @@ void affs_put_inode(struct inode *inode) { pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); - lock_kernel(); affs_free_prealloc(inode); if (atomic_read(&inode->i_count) == 1) { + down(&inode->i_sem); if (inode->i_size != AFFS_I(inode)->mmu_private) affs_truncate(inode); - //if (inode->i_nlink) - // affs_clear_inode(inode); + up(&inode->i_sem); } - unlock_kernel(); } void @@ -284,9 +277,7 @@ affs_delete_inode(struct inode *inode) if (S_ISREG(inode->i_mode)) affs_truncate(inode); clear_inode(inode); - lock_kernel(); affs_free_block(inode->i_sb, inode->i_ino); - unlock_kernel(); } void diff --git a/fs/affs/namei.c b/fs/affs/namei.c index d9bf37b00e05..01defe3d0ff8 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -218,12 +218,10 @@ affs_lookup(struct inode *dir, struct dentry *dentry) pr_debug("AFFS: lookup(\"%.*s\")\n",(int)dentry->d_name.len,dentry->d_name.name); - lock_kernel(); affs_lock_dir(dir); bh = affs_find_entry(dir, dentry); affs_unlock_dir(dir); if (IS_ERR(bh)) { - unlock_kernel(); return ERR_PTR(PTR_ERR(bh)); } if (bh) { @@ -240,12 +238,10 @@ affs_lookup(struct inode *dir, struct dentry *dentry) affs_brelse(bh); inode = iget(sb, ino); if (!inode) { - unlock_kernel(); return ERR_PTR(-EACCES); } } dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations; - unlock_kernel(); d_add(dentry, inode); return NULL; } @@ -253,17 +249,10 @@ affs_lookup(struct inode *dir, struct dentry *dentry) int affs_unlink(struct inode *dir, struct dentry *dentry) { - int res; pr_debug("AFFS: unlink(dir=%d, \"%.*s\")\n", (u32)dir->i_ino, (int)dentry->d_name.len, dentry->d_name.name); - if (!dentry->d_inode) - return -ENOENT; - - lock_kernel(); - res = affs_remove_header(dentry); - unlock_kernel(); - return res; + return affs_remove_header(dentry); } int @@ -276,12 +265,9 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode) pr_debug("AFFS: create(%lu,\"%.*s\",0%o)\n",dir->i_ino,(int)dentry->d_name.len, dentry->d_name.name,mode); - lock_kernel(); inode = affs_new_inode(dir); - if (!inode) { - unlock_kernel(); + if (!inode) return -ENOSPC; - } inode->i_mode = mode; mode_to_prot(inode); @@ -294,10 +280,8 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode) if (error) { inode->i_nlink = 0; iput(inode); - unlock_kernel(); return error; } - unlock_kernel(); return 0; } @@ -310,12 +294,9 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%o)\n",dir->i_ino, (int)dentry->d_name.len,dentry->d_name.name,mode); - lock_kernel(); inode = affs_new_inode(dir); - if (!inode) { - unlock_kernel(); + if (!inode) return -ENOSPC; - } inode->i_mode = S_IFDIR | mode; mode_to_prot(inode); @@ -328,10 +309,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) inode->i_nlink = 0; mark_inode_dirty(inode); iput(inode); - unlock_kernel(); return error; } - unlock_kernel(); return 0; } @@ -357,14 +336,10 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) pr_debug("AFFS: symlink(%lu,\"%.*s\" -> \"%s\")\n",dir->i_ino, (int)dentry->d_name.len,dentry->d_name.name,symname); - lock_kernel(); maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; - error = -ENOSPC; inode = affs_new_inode(dir); - if (!inode) { - unlock_kernel(); + if (!inode) return -ENOSPC; - } inode->i_op = &affs_symlink_inode_operations; inode->i_data.a_ops = &affs_symlink_aops; @@ -410,7 +385,6 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) error = affs_add_entry(dir, inode, dentry, ST_SOFTLINK); if (error) goto err; - unlock_kernel(); return 0; @@ -418,7 +392,6 @@ err: inode->i_nlink = 0; mark_inode_dirty(inode); iput(inode); - unlock_kernel(); return error; } @@ -426,23 +399,11 @@ int affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { struct inode *inode = old_dentry->d_inode; - int error; pr_debug("AFFS: link(%u, %u, \"%.*s\")\n", (u32)inode->i_ino, (u32)dir->i_ino, (int)dentry->d_name.len,dentry->d_name.name); - lock_kernel(); - error = affs_add_entry(dir, inode, dentry, ST_LINKFILE); - if (error) { - /* WTF??? */ - inode->i_nlink = 0; - mark_inode_dirty(inode); - iput(inode); - unlock_kernel(); - return error; - } - unlock_kernel(); - return 0; + return affs_add_entry(dir, inode, dentry, ST_LINKFILE); } int @@ -453,21 +414,19 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, struct buffer_head *bh = NULL; int retval; - lock_kernel(); pr_debug("AFFS: rename(old=%u,\"%*s\" to new=%u,\"%*s\")\n", (u32)old_dir->i_ino, (int)old_dentry->d_name.len, old_dentry->d_name.name, (u32)new_dir->i_ino, (int)new_dentry->d_name.len, new_dentry->d_name.name); - if ((retval = affs_check_name(new_dentry->d_name.name,new_dentry->d_name.len))) - goto done; + retval = affs_check_name(new_dentry->d_name.name,new_dentry->d_name.len); + if (retval) + return retval; /* Unlink destination if it already exists */ if (new_dentry->d_inode) { retval = affs_remove_header(new_dentry); - if (retval) { - unlock_kernel(); + if (retval) return retval; - } } retval = -EIO; @@ -493,6 +452,5 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, done: mark_buffer_dirty_inode(bh, retval ? old_dir : new_dir); affs_brelse(bh); - unlock_kernel(); return retval; } diff --git a/fs/affs/super.c b/fs/affs/super.c index ebc0fb917744..c0608dfef1a4 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -40,7 +40,6 @@ static void affs_put_super(struct super_block *sb) { struct affs_sb_info *sbi = AFFS_SB(sb); - lock_kernel(); pr_debug("AFFS: put_super()\n"); if (!(sb->s_flags & MS_RDONLY)) { @@ -58,7 +57,6 @@ affs_put_super(struct super_block *sb) affs_brelse(sbi->s_root_bh); kfree(sbi); sb->s_fs_info = NULL; - unlock_kernel(); return; } @@ -67,7 +65,7 @@ affs_write_super(struct super_block *sb) { int clean = 2; struct affs_sb_info *sbi = AFFS_SB(sb); - lock_kernel(); + if (!(sb->s_flags & MS_RDONLY)) { // if (sbi->s_bitmap[i].bm_bh) { // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) { @@ -81,7 +79,7 @@ affs_write_super(struct super_block *sb) } else sb->s_dirt = 0; - unlock_kernel(); + pr_debug("AFFS: write_super() at %lu, clean=%d\n", get_seconds(), clean); } static kmem_cache_t * affs_inode_cachep; diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c index c7e53656b540..c01cd4c64a61 100644 --- a/fs/affs/symlink.c +++ b/fs/affs/symlink.c @@ -32,9 +32,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page) pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino); err = -EIO; - lock_kernel(); bh = affs_bread(inode->i_sb, inode->i_ino); - unlock_kernel(); if (!bh) goto fail; i = 0; @@ -63,9 +61,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page) j++; } link[i] = '\0'; - lock_kernel(); affs_brelse(bh); - unlock_kernel(); SetPageUptodate(page); kunmap(page); unlock_page(page); -- cgit v1.2.3 From e54f721e229c8218e1483775edcf602f1d12063b Mon Sep 17 00:00:00 2001 From: "Andries E. Brouwer" Date: Sun, 16 Mar 2003 16:21:10 -0800 Subject: [PATCH] fix affs/super.c Mounting a non-affs filesystem as affs crashes the kernel. The reason is the sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL); memset(sbi, 0, sizeof(*AFFS_SB)); where the second sizeof is 1, so that sbi is not zeroed at all. Also, avoid a warning for printk of sector_t in amigaffs.h. --- fs/affs/super.c | 3 ++- include/linux/amigaffs.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/affs/super.c b/fs/affs/super.c index c0608dfef1a4..3774983a00fd 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -298,7 +298,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) if (!sbi) return -ENOMEM; sb->s_fs_info = sbi; - memset(sbi, 0, sizeof(*AFFS_SB)); + memset(sbi, 0, sizeof(struct affs_sb_info)); + init_MUTEX(&sbi->s_bmlock); if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h index bde160f417fd..6fb6bb5c6696 100644 --- a/include/linux/amigaffs.h +++ b/include/linux/amigaffs.h @@ -73,7 +73,7 @@ static inline void affs_brelse(struct buffer_head *bh) { if (bh) - pr_debug("affs_brelse: %ld\n", bh->b_blocknr); + pr_debug("affs_brelse: %lld\n", (long long) bh->b_blocknr); brelse(bh); } -- cgit v1.2.3 From 544db1a2d5b3ddc331bbb3370a4092475141e67d Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:13:21 -0800 Subject: [PATCH] Pass the load address into ELF_PLAT_INIT() Patch from Anton Blanchard With ppc64 64bit dynamic executables we have to relocate the contents of the function descriptor. Passing in the load address to ELF_PLAT_INIT allows us to do this. The patch allows ppc64 to run 64-bit executables and is a no-op for other architectures. --- arch/s390x/kernel/binfmt_elf32.c | 2 +- arch/x86_64/ia32/ia32_binfmt.c | 2 +- fs/binfmt_elf.c | 13 ++++++++++--- include/asm-alpha/elf.h | 2 +- include/asm-arm/elf.h | 2 +- include/asm-cris/elf.h | 2 +- include/asm-i386/elf.h | 2 +- include/asm-ia64/elf.h | 2 +- include/asm-ia64/ia32.h | 2 +- include/asm-m68k/elf.h | 2 +- include/asm-m68knommu/elf.h | 2 +- include/asm-mips/elf.h | 2 +- include/asm-mips64/elf.h | 2 +- include/asm-parisc/elf.h | 2 +- include/asm-ppc64/elf.h | 3 ++- include/asm-s390/elf.h | 2 +- include/asm-s390x/elf.h | 2 +- include/asm-sh/elf.h | 2 +- include/asm-um/archparam-i386.h | 2 +- include/asm-v850/elf.h | 2 +- include/asm-x86_64/elf.h | 2 +- 21 files changed, 31 insertions(+), 23 deletions(-) (limited to 'fs') diff --git a/arch/s390x/kernel/binfmt_elf32.c b/arch/s390x/kernel/binfmt_elf32.c index 6a3e3f21a2b2..afa0d62df611 100644 --- a/arch/s390x/kernel/binfmt_elf32.c +++ b/arch/s390x/kernel/binfmt_elf32.c @@ -36,7 +36,7 @@ /* For SVR4/S390 the function pointer to be registered with `atexit` is passed in R14. */ -#define ELF_PLAT_INIT(_r) \ +#define ELF_PLAT_INIT(_r, load_addr) \ do { \ _r->gprs[14] = 0; \ set_thread_flag(TIF_31BIT); \ diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c index 9cd341281cb7..8fd01a20417f 100644 --- a/arch/x86_64/ia32/ia32_binfmt.c +++ b/arch/x86_64/ia32/ia32_binfmt.c @@ -217,7 +217,7 @@ do { \ # define CONFIG_BINFMT_ELF_MODULE CONFIG_BINFMT_ELF32_MODULE #endif -#define ELF_PLAT_INIT(r) elf32_init(r) +#define ELF_PLAT_INIT(r, load_addr) elf32_init(r) #define setup_arg_pages(bprm) ia32_setup_arg_pages(bprm) int ia32_setup_arg_pages(struct linux_binprm *bprm); diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 5a643a493345..409ab7469996 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -452,6 +452,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) unsigned int size; unsigned long elf_entry, interp_load_addr = 0; unsigned long start_code, end_code, start_data, end_data; + unsigned long reloc_func_desc = 0; struct elfhdr elf_ex; struct elfhdr interp_elf_ex; struct exec interp_ex; @@ -695,6 +696,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) load_bias += error - ELF_PAGESTART(load_bias + vaddr); load_addr += load_bias; + reloc_func_desc = load_addr; } } k = elf_ppnt->p_vaddr; @@ -742,6 +744,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) retval = -ENOEXEC; /* Nobody gets to see this, but.. */ goto out; } + reloc_func_desc = interp_load_addr; } else { elf_entry = elf_ex.e_entry; } @@ -789,10 +792,14 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) /* * The ABI may specify that certain registers be set up in special * ways (on i386 %edx is the address of a DT_FINI function, for - * example. This macro performs whatever initialization to - * the regs structure is required. + * example. In addition, it may also specify (eg, PowerPC64 ELF) + * that the e_entry field is the address of the function descriptor + * for the startup routine, rather than the address of the startup + * routine itself. This macro performs whatever initialization to + * the regs structure is required as well as any relocations to the + * function descriptor entries when executing dynamically links apps. */ - ELF_PLAT_INIT(regs); + ELF_PLAT_INIT(regs, reloc_func_desc); #endif start_thread(regs, elf_entry, bprm->p); diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h index 033597e3e0ab..deb49419d65d 100644 --- a/include/asm-alpha/elf.h +++ b/include/asm-alpha/elf.h @@ -50,7 +50,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; we start programs with a value of 0 to indicate that there is no such function. */ -#define ELF_PLAT_INIT(_r) _r->r0 = 0 +#define ELF_PLAT_INIT(_r, load_addr) _r->r0 = 0 /* The registers are layed out in pt_regs for PAL and syscall convenience. Re-order them for the linear elf_gregset_t. */ diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index 7ebef35ec653..00deda790e01 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -48,7 +48,7 @@ typedef struct { void *null; } elf_fpregset_t; /* When the program starts, a1 contains a pointer to a function to be registered with atexit, as per the SVR4 ABI. A value of 0 means we have no such handler. */ -#define ELF_PLAT_INIT(_r) (_r)->ARM_r0 = 0 +#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0 /* This yields a mask that user programs can use to figure out what instruction set this cpu supports. */ diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h index dba80d0609ef..798aeaeaabd1 100644 --- a/include/asm-cris/elf.h +++ b/include/asm-cris/elf.h @@ -39,7 +39,7 @@ typedef unsigned long elf_fpregset_t; A value of 0 tells we have no such handler. */ /* Explicitly set registers to 0 to increase determinism. */ -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ (_r)->r13 = 0; (_r)->r12 = 0; (_r)->r11 = 0; (_r)->r10 = 0; \ (_r)->r9 = 0; (_r)->r8 = 0; (_r)->r7 = 0; (_r)->r6 = 0; \ (_r)->r5 = 0; (_r)->r4 = 0; (_r)->r3 = 0; (_r)->r2 = 0; \ diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 73f4067e3995..e893fbf20593 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -43,7 +43,7 @@ typedef struct user_fxsr_struct elf_fpxregset_t; We might as well make sure everything else is cleared too (except for %esp), just to make things more deterministic. */ -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ _r->ebx = 0; _r->ecx = 0; _r->edx = 0; \ _r->esi = 0; _r->edi = 0; _r->ebp = 0; \ _r->eax = 0; \ diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h index 8fb191e7712e..4ff7995fae2f 100644 --- a/include/asm-ia64/elf.h +++ b/include/asm-ia64/elf.h @@ -50,7 +50,7 @@ * talk to him... */ extern void ia64_init_addr_space (void); -#define ELF_PLAT_INIT(_r) ia64_init_addr_space() +#define ELF_PLAT_INIT(_r, load_addr) ia64_init_addr_space() /* ELF register definitions. This is needed for core dump support. */ diff --git a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h index 4824df582b8a..35f3b28272c4 100644 --- a/include/asm-ia64/ia32.h +++ b/include/asm-ia64/ia32.h @@ -306,7 +306,7 @@ struct old_linux32_dirent { #define ELF_ET_DYN_BASE (IA32_PAGE_OFFSET/3 + 0x1000000) void ia64_elf32_init(struct pt_regs *regs); -#define ELF_PLAT_INIT(_r) ia64_elf32_init(_r) +#define ELF_PLAT_INIT(_r, load_addr) ia64_elf32_init(_r) #define elf_addr_t u32 diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h index e2743983c3ba..48fa3301dcba 100644 --- a/include/asm-m68k/elf.h +++ b/include/asm-m68k/elf.h @@ -31,7 +31,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t; /* For SVR4/m68k the function pointer to be registered with `atexit' is passed in %a1. Although my copy of the ABI has no such statement, it is actually used on ASV. */ -#define ELF_PLAT_INIT(_r) _r->a1 = 0 +#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0 #define USE_ELF_CORE_DUMP #ifndef CONFIG_SUN3 diff --git a/include/asm-m68knommu/elf.h b/include/asm-m68knommu/elf.h index 566f96120a1f..951a12b26722 100644 --- a/include/asm-m68knommu/elf.h +++ b/include/asm-m68knommu/elf.h @@ -31,7 +31,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t; /* For SVR4/m68k the function pointer to be registered with `atexit' is passed in %a1. Although my copy of the ABI has no such statement, it is actually used on ASV. */ -#define ELF_PLAT_INIT(_r) _r->a1 = 0 +#define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0 #define USE_ELF_CORE_DUMP #ifndef CONFIG_SUN3 diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index f37acc0f8f1f..e6969081689e 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -73,7 +73,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; * See comments in asm-alpha/elf.h, this is the same thing * on the MIPS. */ -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \ _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \ _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \ diff --git a/include/asm-mips64/elf.h b/include/asm-mips64/elf.h index 2fbde92931bd..43a244f9f762 100644 --- a/include/asm-mips64/elf.h +++ b/include/asm-mips64/elf.h @@ -76,7 +76,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; * See comments in asm-alpha/elf.h, this is the same thing * on the MIPS. */ -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \ _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \ _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \ diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h index c9c8a60d66bf..ea946f11abe6 100644 --- a/include/asm-parisc/elf.h +++ b/include/asm-parisc/elf.h @@ -121,7 +121,7 @@ struct pt_regs; /* forward declaration... */ So that we can use the same startup file with static executables, we start programs with a value of 0 to indicate that there is no such function. */ -#define ELF_PLAT_INIT(_r) _r->gr[23] = 0 +#define ELF_PLAT_INIT(_r, load_addr) _r->gr[23] = 0 #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 diff --git a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h index d792a1868af5..6913dc50e904 100644 --- a/include/asm-ppc64/elf.h +++ b/include/asm-ppc64/elf.h @@ -84,9 +84,10 @@ ppc64_elf_core_copy_regs(elf_gregset_t dstRegs, struct pt_regs* srcRegs) #define ELF_PLATFORM (NULL) -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ memset(_r->gpr, 0, sizeof(_r->gpr)); \ _r->ctr = _r->link = _r->xer = _r->ccr = 0; \ + _r->gpr[2] = load_addr; \ } while (0) #ifdef __KERNEL__ diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index 0be5cfd90ca2..1b2f79a69afa 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h @@ -36,7 +36,7 @@ typedef s390_regs elf_gregset_t; /* For SVR4/S390 the function pointer to be registered with `atexit` is passed in R14. */ -#define ELF_PLAT_INIT(_r) \ +#define ELF_PLAT_INIT(_r, load_addr) \ _r->gprs[14] = 0 #define USE_ELF_CORE_DUMP diff --git a/include/asm-s390x/elf.h b/include/asm-s390x/elf.h index df7559584881..719d0afdc21d 100644 --- a/include/asm-s390x/elf.h +++ b/include/asm-s390x/elf.h @@ -36,7 +36,7 @@ typedef s390_regs elf_gregset_t; /* For SVR4/S390 the function pointer to be registered with `atexit` is passed in R14. */ -#define ELF_PLAT_INIT(_r) \ +#define ELF_PLAT_INIT(_r, load_addr) \ do { \ _r->gprs[14] = 0; \ clear_thread_flag(TIF_31BIT); \ diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 001cdd8e78ab..a0a579237cb5 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h @@ -61,7 +61,7 @@ typedef struct user_fpu_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define ELF_PLAT_INIT(_r) \ +#define ELF_PLAT_INIT(_r, load_addr) \ do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \ _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \ _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \ diff --git a/include/asm-um/archparam-i386.h b/include/asm-um/archparam-i386.h index bd11a0d536b7..a23261baab5d 100644 --- a/include/asm-um/archparam-i386.h +++ b/include/asm-um/archparam-i386.h @@ -23,7 +23,7 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 -#define ELF_PLAT_INIT(regs) do { \ +#define ELF_PLAT_INIT(regs, load_addr) do { \ PT_REGS_EBX(regs) = 0; \ PT_REGS_ECX(regs) = 0; \ PT_REGS_EDX(regs) = 0; \ diff --git a/include/asm-v850/elf.h b/include/asm-v850/elf.h index 0e42ae4ed529..7db8edffb1c6 100644 --- a/include/asm-v850/elf.h +++ b/include/asm-v850/elf.h @@ -81,7 +81,7 @@ typedef struct user_fpu_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define ELF_PLAT_INIT(_r) \ +#define ELF_PLAT_INIT(_r, load_addr) \ do { \ _r->gpr[0] = _r->gpr[1] = _r->gpr[2] = _r->gpr[3] = \ _r->gpr[4] = _r->gpr[5] = _r->gpr[6] = _r->gpr[7] = \ diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h index 7d9d5df88456..cc0690b7073b 100644 --- a/include/asm-x86_64/elf.h +++ b/include/asm-x86_64/elf.h @@ -39,7 +39,7 @@ typedef struct user_i387_struct elf_fpregset_t; We might as well make sure everything else is cleared too (except for %esp), just to make things more deterministic. */ -#define ELF_PLAT_INIT(_r) do { \ +#define ELF_PLAT_INIT(_r, load_addr) do { \ struct task_struct *cur = current; \ (_r)->rbx = 0; (_r)->rcx = 0; (_r)->rdx = 0; \ (_r)->rsi = 0; (_r)->rdi = 0; (_r)->rbp = 0; \ -- cgit v1.2.3 From 55b31e113f46486cf95b47976c75de81162c3818 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:14:09 -0800 Subject: [PATCH] use set_current_state in fs Patch from Robert Love This patch is by Inaky Perez-Gonzalez. There are a couple uses of 'p->state=foo' in fs/ which are open coded. This patch converts them to the proper [__]set_current_state() function. --- fs/exec.c | 2 +- fs/inode.c | 2 +- fs/locks.c | 4 ++-- fs/select.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'fs') diff --git a/fs/exec.c b/fs/exec.c index 061f96130173..f0b70ae3698d 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -633,7 +633,7 @@ static inline int de_thread(struct task_struct *tsk) count = 1; while (atomic_read(&oldsig->count) > count) { oldsig->group_exit_task = current; - current->state = TASK_UNINTERRUPTIBLE; + __set_current_state(TASK_UNINTERRUPTIBLE); spin_unlock_irq(lock); schedule(); spin_lock_irq(lock); diff --git a/fs/inode.c b/fs/inode.c index 200d338ad629..e54c9ae0169b 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1214,7 +1214,7 @@ repeat: goto repeat; } remove_wait_queue(wq, &wait); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); } void wake_up_inode(struct inode *inode) diff --git a/fs/locks.c b/fs/locks.c index 90f4211bb1d9..1e78fd26a18b 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -565,7 +565,7 @@ static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout int result = 0; DECLARE_WAITQUEUE(wait, current); - current->state = TASK_INTERRUPTIBLE; + __set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(fl_wait, &wait); if (timeout == 0) schedule(); @@ -574,7 +574,7 @@ static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout if (signal_pending(current)) result = -ERESTARTSYS; remove_wait_queue(fl_wait, &wait); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); return result; } diff --git a/fs/select.c b/fs/select.c index 510e1defe964..ce46b5c90eb5 100644 --- a/fs/select.c +++ b/fs/select.c @@ -235,7 +235,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout) } __timeout = schedule_timeout(__timeout); } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); poll_freewait(&table); @@ -425,7 +425,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list, break; timeout = schedule_timeout(timeout); } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); return count; } -- cgit v1.2.3 From cc6c76b93381fd8ba46ddd162a812c10a51b4352 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:15:03 -0800 Subject: [PATCH] file_list_lock contention fixes Patch from Manfred Spraul Fixes the lock contention over file_list_lock by simply removing the unneeded anon_list. So filp allocation does not need to take a global lock any more. The use of a spinlock to protect files_stat.nr_files is a bit awkward, but the alternative is a custom sysctl handler, and isn't much more efficient anyway. --- fs/dcache.c | 3 +- fs/file_table.c | 132 +++++++++++++++++++++++++++++++-------------------- include/linux/file.h | 3 ++ 3 files changed, 85 insertions(+), 53 deletions(-) (limited to 'fs') diff --git a/fs/dcache.c b/fs/dcache.c index fe7ea6a39943..719571fa0e47 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1574,7 +1575,7 @@ void __init vfs_caches_init(unsigned long mempages) filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); + SLAB_HWCACHE_ALIGN, filp_ctor, filp_dtor); if(!filp_cachep) panic("Cannot create filp SLAB cache"); diff --git a/fs/file_table.c b/fs/file_table.c index 3a38f7480328..024970c85308 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -22,12 +22,45 @@ struct files_stat_struct files_stat = { .max_files = NR_FILE }; -/* Here the new files go */ -static LIST_HEAD(anon_list); -/* And here the free ones sit */ +/* list of free filps for root */ static LIST_HEAD(free_list); /* public *and* exported. Not pretty! */ -spinlock_t files_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; +spinlock_t __cacheline_aligned_in_smp files_lock = SPIN_LOCK_UNLOCKED; + +static spinlock_t filp_count_lock = SPIN_LOCK_UNLOCKED; + +/* slab constructors and destructors are called from arbitrary + * context and must be fully threaded - use a local spinlock + * to protect files_stat.nr_files + */ +void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags) +{ + if ((cflags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == + SLAB_CTOR_CONSTRUCTOR) { + unsigned long flags; + spin_lock_irqsave(&filp_count_lock, flags); + files_stat.nr_files++; + spin_unlock_irqrestore(&filp_count_lock, flags); + } +} + +void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags) +{ + unsigned long flags; + spin_lock_irqsave(&filp_count_lock, flags); + files_stat.nr_files--; + spin_unlock_irqrestore(&filp_count_lock, flags); +} + +static inline void file_free(struct file* f) +{ + if (files_stat.nr_free_files <= NR_RESERVED_FILES) { + list_add(&f->f_list, &free_list); + files_stat.nr_free_files++; + } else { + kmem_cache_free(filp_cachep, f); + } +} /* Find an unused file structure and return a pointer to it. * Returns NULL, if there are no more free file structures or @@ -37,57 +70,48 @@ spinlock_t files_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; */ struct file * get_empty_filp(void) { - static int old_max = 0; +static int old_max = 0; struct file * f; + if (likely(files_stat.nr_files < files_stat.max_files)) { + f = kmem_cache_alloc(filp_cachep, SLAB_KERNEL); + if (f) { +got_one: + memset(f, 0, sizeof(*f)); + if (security_file_alloc(f)) { + file_list_lock(); + file_free(f); + file_list_unlock(); + + return NULL; + } + eventpoll_init_file(f); + atomic_set(&f->f_count,1); + f->f_uid = current->fsuid; + f->f_gid = current->fsgid; + f->f_owner.lock = RW_LOCK_UNLOCKED; + /* f->f_version, f->f_list.next: 0 */ + return f; + } + } + /* Use a reserved one if we're the superuser */ file_list_lock(); - if (files_stat.nr_free_files > NR_RESERVED_FILES) { - used_one: + if (files_stat.nr_free_files && !current->euid) { f = list_entry(free_list.next, struct file, f_list); list_del(&f->f_list); files_stat.nr_free_files--; - new_one: - memset(f, 0, sizeof(*f)); - if (security_file_alloc(f)) { - list_add(&f->f_list, &free_list); - files_stat.nr_free_files++; - file_list_unlock(); - return NULL; - } - eventpoll_init_file(f); - atomic_set(&f->f_count,1); - f->f_version = 0; - f->f_uid = current->fsuid; - f->f_gid = current->fsgid; - f->f_owner.lock = RW_LOCK_UNLOCKED; - list_add(&f->f_list, &anon_list); file_list_unlock(); - return f; + goto got_one; } - /* - * Use a reserved one if we're the superuser - */ - if (files_stat.nr_free_files && !current->euid) - goto used_one; - /* - * Allocate a new one if we're below the limit. - */ - if (files_stat.nr_files < files_stat.max_files) { - file_list_unlock(); - f = kmem_cache_alloc(filp_cachep, SLAB_KERNEL); - file_list_lock(); - if (f) { - files_stat.nr_files++; - goto new_one; - } - /* Big problems... */ - printk(KERN_WARNING "VFS: filp allocation failed\n"); - - } else if (files_stat.max_files > old_max) { + file_list_unlock(); + /* Ran out of filps - report that */ + if (files_stat.max_files > old_max) { printk(KERN_INFO "VFS: file-max limit %d reached\n", files_stat.max_files); old_max = files_stat.max_files; + } else { + /* Big problems... */ + printk(KERN_WARNING "VFS: filp allocation failed\n"); } - file_list_unlock(); return NULL; } @@ -108,6 +132,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags) filp->f_uid = current->fsuid; filp->f_gid = current->fsgid; filp->f_op = dentry->d_inode->i_fop; + filp->f_list.next = NULL; error = security_file_alloc(filp); if (!error) if (filp->f_op && filp->f_op->open) { @@ -162,9 +187,9 @@ void __fput(struct file * file) file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; - list_del(&file->f_list); - list_add(&file->f_list, &free_list); - files_stat.nr_free_files++; + if (file->f_list.next) + list_del(&file->f_list); + file_free(file); file_list_unlock(); dput(dentry); mntput(mnt); @@ -190,9 +215,9 @@ void put_filp(struct file *file) if(atomic_dec_and_test(&file->f_count)) { security_file_free(file); file_list_lock(); - list_del(&file->f_list); - list_add(&file->f_list, &free_list); - files_stat.nr_free_files++; + if (file->f_list.next) + list_del(&file->f_list); + file_free(file); file_list_unlock(); } } @@ -202,7 +227,8 @@ void file_move(struct file *file, struct list_head *list) if (!list) return; file_list_lock(); - list_del(&file->f_list); + if (file->f_list.next) + list_del(&file->f_list); list_add(&file->f_list, list); file_list_unlock(); } @@ -210,7 +236,9 @@ void file_move(struct file *file, struct list_head *list) void file_kill(struct file *file) { file_list_lock(); - list_del_init(&file->f_list); + if (file->f_list.next) + list_del(&file->f_list); + file->f_list.next = NULL; file_list_unlock(); } diff --git a/include/linux/file.h b/include/linux/file.h index e5c90a88ba71..0bfe318d873b 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -40,6 +40,9 @@ extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag)); extern void put_filp(struct file *); extern int get_unused_fd(void); extern void FASTCALL(put_unused_fd(unsigned int fd)); +struct kmem_cache_s; +extern void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags); +extern void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags); extern struct file ** alloc_fd_array(int); extern int expand_fd_array(struct files_struct *, int nr); -- cgit v1.2.3 From d684d33e45a1aa8b307b088f88de1346b10e9d2f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:15:48 -0800 Subject: [PATCH] file_list cleanup Replace the odd handling of f_list.next = NULL with list_emptiness. --- fs/file_table.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'fs') diff --git a/fs/file_table.c b/fs/file_table.c index 024970c85308..ae03438a0331 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -74,7 +74,7 @@ static int old_max = 0; struct file * f; if (likely(files_stat.nr_files < files_stat.max_files)) { - f = kmem_cache_alloc(filp_cachep, SLAB_KERNEL); + f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); if (f) { got_one: memset(f, 0, sizeof(*f)); @@ -90,7 +90,8 @@ got_one: f->f_uid = current->fsuid; f->f_gid = current->fsgid; f->f_owner.lock = RW_LOCK_UNLOCKED; - /* f->f_version, f->f_list.next: 0 */ + /* f->f_version: 0 */ + INIT_LIST_HEAD(&f->f_list); return f; } } @@ -132,7 +133,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags) filp->f_uid = current->fsuid; filp->f_gid = current->fsgid; filp->f_op = dentry->d_inode->i_fop; - filp->f_list.next = NULL; + INIT_LIST_HEAD(&filp->f_list); error = security_file_alloc(filp); if (!error) if (filp->f_op && filp->f_op->open) { @@ -187,8 +188,7 @@ void __fput(struct file * file) file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; - if (file->f_list.next) - list_del(&file->f_list); + list_del(&file->f_list); file_free(file); file_list_unlock(); dput(dentry); @@ -215,8 +215,7 @@ void put_filp(struct file *file) if(atomic_dec_and_test(&file->f_count)) { security_file_free(file); file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); + list_del(&file->f_list); file_free(file); file_list_unlock(); } @@ -227,18 +226,14 @@ void file_move(struct file *file, struct list_head *list) if (!list) return; file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); - list_add(&file->f_list, list); + list_move(&file->f_list, list); file_list_unlock(); } void file_kill(struct file *file) { file_list_lock(); - if (file->f_list.next) - list_del(&file->f_list); - file->f_list.next = NULL; + list_del_init(&file->f_list); file_list_unlock(); } -- cgit v1.2.3 From 4cac8a2859015b387c419e2a6d3bccb7eda04642 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:16:31 -0800 Subject: [PATCH] file_table: remove the private freelist - Remove the private freelist. There's no point in special-casing file structure allocations in this way. - Hence the freeing of files can be moved outside file_list_lock() - Replace euid test with capable(CAP_SYS_ADMIN). - Tidy various other things up. --- fs/file_table.c | 68 +++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 43 deletions(-) (limited to 'fs') diff --git a/fs/file_table.c b/fs/file_table.c index ae03438a0331..2802c9ae504e 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -22,8 +22,6 @@ struct files_stat_struct files_stat = { .max_files = NR_FILE }; -/* list of free filps for root */ -static LIST_HEAD(free_list); /* public *and* exported. Not pretty! */ spinlock_t __cacheline_aligned_in_smp files_lock = SPIN_LOCK_UNLOCKED; @@ -52,41 +50,34 @@ void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags) spin_unlock_irqrestore(&filp_count_lock, flags); } -static inline void file_free(struct file* f) +static inline void file_free(struct file *f) { - if (files_stat.nr_free_files <= NR_RESERVED_FILES) { - list_add(&f->f_list, &free_list); - files_stat.nr_free_files++; - } else { - kmem_cache_free(filp_cachep, f); - } + kmem_cache_free(filp_cachep, f); } /* Find an unused file structure and return a pointer to it. * Returns NULL, if there are no more free file structures or * we run out of memory. - * - * SMP-safe. */ -struct file * get_empty_filp(void) +struct file *get_empty_filp(void) { static int old_max = 0; struct file * f; - if (likely(files_stat.nr_files < files_stat.max_files)) { + /* + * Privileged users can go above max_files + */ + if (files_stat.nr_files < files_stat.max_files || + capable(CAP_SYS_ADMIN)) { f = kmem_cache_alloc(filp_cachep, GFP_KERNEL); if (f) { -got_one: memset(f, 0, sizeof(*f)); if (security_file_alloc(f)) { - file_list_lock(); file_free(f); - file_list_unlock(); - - return NULL; + goto fail; } eventpoll_init_file(f); - atomic_set(&f->f_count,1); + atomic_set(&f->f_count, 1); f->f_uid = current->fsuid; f->f_gid = current->fsgid; f->f_owner.lock = RW_LOCK_UNLOCKED; @@ -95,24 +86,17 @@ got_one: return f; } } - /* Use a reserved one if we're the superuser */ - file_list_lock(); - if (files_stat.nr_free_files && !current->euid) { - f = list_entry(free_list.next, struct file, f_list); - list_del(&f->f_list); - files_stat.nr_free_files--; - file_list_unlock(); - goto got_one; - } - file_list_unlock(); + /* Ran out of filps - report that */ - if (files_stat.max_files > old_max) { - printk(KERN_INFO "VFS: file-max limit %d reached\n", files_stat.max_files); + if (files_stat.max_files >= old_max) { + printk(KERN_INFO "VFS: file-max limit %d reached\n", + files_stat.max_files); old_max = files_stat.max_files; } else { /* Big problems... */ printk(KERN_WARNING "VFS: filp allocation failed\n"); } +fail: return NULL; } @@ -166,11 +150,11 @@ void fput(struct file * file) /* __fput is called from task context when aio completion releases the last * last use of a struct file *. Do not use otherwise. */ -void __fput(struct file * file) +void __fput(struct file *file) { - struct dentry * dentry = file->f_dentry; - struct vfsmount * mnt = file->f_vfsmnt; - struct inode * inode = dentry->d_inode; + struct dentry *dentry = file->f_dentry; + struct vfsmount *mnt = file->f_vfsmnt; + struct inode *inode = dentry->d_inode; /* * The function eventpoll_release() should be the first called @@ -189,15 +173,15 @@ void __fput(struct file * file) file->f_dentry = NULL; file->f_vfsmnt = NULL; list_del(&file->f_list); - file_free(file); file_list_unlock(); + file_free(file); dput(dentry); mntput(mnt); } -struct file * fget(unsigned int fd) +struct file *fget(unsigned int fd) { - struct file * file; + struct file *file; struct files_struct *files = current->files; read_lock(&files->file_lock); @@ -208,16 +192,14 @@ struct file * fget(unsigned int fd) return file; } -/* Here. put_filp() is SMP-safe now. */ - void put_filp(struct file *file) { - if(atomic_dec_and_test(&file->f_count)) { + if (atomic_dec_and_test(&file->f_count)) { security_file_free(file); file_list_lock(); list_del(&file->f_list); - file_free(file); file_list_unlock(); + file_free(file); } } @@ -251,7 +233,7 @@ int fs_may_remount_ro(struct super_block *sb) if (inode->i_nlink == 0) goto too_bad; - /* Writable file? */ + /* Writeable file? */ if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE)) goto too_bad; } -- cgit v1.2.3 From 8e82373a02b96aee8e464b615316d8a1e279e3cd Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:16:57 -0800 Subject: [PATCH] file_list: less locking - optimise file_kill() to not take the global lock if the file is not on a list. - Use optimised file_kill() in a few places rather than open-coding the list removal. --- fs/file_table.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'fs') diff --git a/fs/file_table.c b/fs/file_table.c index 2802c9ae504e..8ae8d29c2365 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -169,11 +169,9 @@ void __fput(struct file *file) fops_put(file->f_op); if (file->f_mode & FMODE_WRITE) put_write_access(inode); - file_list_lock(); file->f_dentry = NULL; file->f_vfsmnt = NULL; - list_del(&file->f_list); - file_list_unlock(); + file_kill(file); file_free(file); dput(dentry); mntput(mnt); @@ -196,9 +194,7 @@ void put_filp(struct file *file) { if (atomic_dec_and_test(&file->f_count)) { security_file_free(file); - file_list_lock(); - list_del(&file->f_list); - file_list_unlock(); + file_kill(file); file_free(file); } } @@ -214,9 +210,11 @@ void file_move(struct file *file, struct list_head *list) void file_kill(struct file *file) { - file_list_lock(); - list_del_init(&file->f_list); - file_list_unlock(); + if (!list_empty(&file->f_list)) { + file_list_lock(); + list_del_init(&file->f_list); + file_list_unlock(); + } } int fs_may_remount_ro(struct super_block *sb) -- cgit v1.2.3 From 6bd4c9f3e8abfd09308f5627e8eddf74df331def Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:18:24 -0800 Subject: [PATCH] memleak in fs/nfs/inode.c::nfs_get_sb() Patch from Oleg Drokin There is trivial memleak on error exit path in nfs get_sb function. --- fs/nfs/inode.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs') diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index ea39aa340908..67ed9d1bc1b8 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1231,6 +1231,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, if (root->size > sizeof(root->data)) { printk("nfs_get_sb: invalid root filehandle\n"); + kfree(server); return ERR_PTR(-EINVAL); } /* We now require that the mount process passes the remote address */ -- cgit v1.2.3 From 58a90ba8f6ae3728957c2f6e0adfba6b07011e3c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:18:44 -0800 Subject: [PATCH] Memleak in fs/ufs/util.c Patch from Oleg Drokin There is trivial memleak on error exit path in fs/ufs/util.c::_ubh_bread_() --- fs/ufs/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs') diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 41b5a8567eda..7656699c165d 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c @@ -48,6 +48,7 @@ struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi, failed: for (j = 0; j < i; j++) brelse (ubh->bh[j]); + kfree(ubh); return NULL; } -- cgit v1.2.3 From 5d954f33f8fa6990b1a9679595e71a5a0ef2a431 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:20:10 -0800 Subject: [PATCH] /proc/sysrq-trigger: trigger sysrq functions via This makes sysrq facilities available to remote users. Writing a 'C' to /proc/sysrq-trigger receives the same treatment as typing sysrq-C on the local keyboard. --- Documentation/sysrq.txt | 4 ++++ fs/proc/proc_misc.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'fs') diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt index 23eddf174e41..230c05996bd9 100644 --- a/Documentation/sysrq.txt +++ b/Documentation/sysrq.txt @@ -36,6 +36,10 @@ On PowerPC - Press 'ALT - Print Screen (or F13) - , On other - If you know of the key combos for other architectures, please let me know so I can add them to this section. +On all - write a character to /proc/sysrq-trigger. eg: + + echo t > /proc/sysrq-trigger + * What are the 'command' keys? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'r' - Turns off keyboard raw mode and sets it to XLATE. diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index f7c79e8704ee..f7332ea47ea1 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -521,6 +522,28 @@ static struct file_operations proc_profile_operations = { .write = write_profile, }; +#ifdef CONFIG_MAGIC_SYSRQ +/* + * writing 'C' to /proc/sysrq-trigger is like sysrq-C + */ +static ssize_t write_sysrq_trigger(struct file *file, const char *buf, + size_t count, loff_t *ppos) +{ + if (count) { + char c; + + if (get_user(c, buf)) + return -EFAULT; + handle_sysrq(c, NULL, NULL); + } + return count; +} + +static struct file_operations proc_sysrq_trigger_operations = { + .write = write_sysrq_trigger, +}; +#endif + struct proc_dir_entry *proc_root_kcore; static void create_seq_entry(char *name, mode_t mode, struct file_operations *f) @@ -592,6 +615,11 @@ void __init proc_misc_init(void) entry->size = (1+prof_len) * sizeof(unsigned int); } } +#ifdef CONFIG_MAGIC_SYSRQ + entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL); + if (entry) + entry->proc_fops = &proc_sysrq_trigger_operations; +#endif #ifdef CONFIG_PPC32 { extern struct file_operations ppc_htab_operations; -- cgit v1.2.3 From 18f3cae294f90eb9a96fafcc1ffe2c1bb837f5a2 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 17 Mar 2003 21:20:29 -0800 Subject: [PATCH] Fix nfsd_symlink() failure path Patch from Andreas Gruenbacher In both 2.5 and 2.4, the fs/nfsd/vfs.c:nfsd_symlink() function calls down to notify_change(). If notify_change fails for some reason, the error code is not converted to an nfs no-the-wire error code as is should. The attached patches fix that (one for 2.4, the other for 2.5). --- fs/nfsd/vfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 35a13a950f90..03e8f194fff2 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1203,7 +1203,9 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, iap->ia_mode = (iap->ia_mode&S_IALLUGO) | S_IFLNK; err = notify_change(dnew, iap); - if (!err && EX_ISSYNC(fhp->fh_export)) + if (err) + err = nfserrno(err); + else if (EX_ISSYNC(fhp->fh_export)) write_inode_now(dentry->d_inode, 1); } } -- cgit v1.2.3