summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
commitb2ad5f821b1381492d792ca10b1eb7a107b48f14 (patch)
tree954a648692e7da983db1d2470953705f6a729264 /fs
parentc9c06167e7933d93a6e396174c68abf242294abb (diff)
Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your
Makefiles.
Diffstat (limited to 'fs')
-rw-r--r--fs/Makefile13
-rw-r--r--fs/adfs/Makefile5
-rw-r--r--fs/adfs/inode.c2
-rw-r--r--fs/affs/Makefile5
-rw-r--r--fs/affs/file.c2
-rw-r--r--fs/affs/symlink.c2
-rw-r--r--fs/autofs/Makefile27
-rw-r--r--fs/autofs4/Makefile28
-rw-r--r--fs/bfs/Makefile5
-rw-r--r--fs/buffer.c63
-rw-r--r--fs/coda/Makefile7
-rw-r--r--fs/coda/dir.c8
-rw-r--r--fs/coda/file.c4
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/coda/symlink.c2
-rw-r--r--fs/cramfs/Makefile4
-rw-r--r--fs/cramfs/inflate/Makefile4
-rw-r--r--fs/cramfs/inode.c2
-rw-r--r--fs/devfs/Makefile5
-rw-r--r--fs/devpts/Makefile5
-rw-r--r--fs/efs/Makefile5
-rw-r--r--fs/efs/symlink.c2
-rw-r--r--fs/exec.c108
-rw-r--r--fs/ext2/Makefile5
-rw-r--r--fs/ext2/balloc.c70
-rw-r--r--fs/ext2/inode.c10
-rw-r--r--fs/ext2/super.c105
-rw-r--r--fs/fat/Makefile8
-rw-r--r--fs/fat/cache.c12
-rw-r--r--fs/fat/inode.c8
-rw-r--r--fs/hfs/Makefile5
-rw-r--r--fs/hfs/inode.c2
-rw-r--r--fs/hpfs/Makefile5
-rw-r--r--fs/hpfs/file.c2
-rw-r--r--fs/hpfs/namei.c2
-rw-r--r--fs/inode.c17
-rw-r--r--fs/isofs/Makefile8
-rw-r--r--fs/isofs/rock.c2
-rw-r--r--fs/jffs/Makefile4
-rw-r--r--fs/jffs/inode-v23.c2
-rw-r--r--fs/lockd/Makefile14
-rw-r--r--fs/lockd/svc.c1
-rw-r--r--fs/lockd/xdr4.c3
-rw-r--r--fs/minix/Makefile5
-rw-r--r--fs/msdos/Makefile8
-rw-r--r--fs/namei.c3
-rw-r--r--fs/ncpfs/Makefile5
-rw-r--r--fs/ncpfs/symlink.c2
-rw-r--r--fs/nfs/Makefile13
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/write.c2
-rw-r--r--fs/nfsd/Makefile10
-rw-r--r--fs/nfsd/nfs3xdr.c20
-rw-r--r--fs/nfsd/vfs.c29
-rw-r--r--fs/nls/Config.in9
-rw-r--r--fs/nls/Makefile3
-rw-r--r--fs/ntfs/Makefile5
-rw-r--r--fs/ntfs/fs.c4
-rw-r--r--fs/openpromfs/Makefile5
-rw-r--r--fs/partitions/Makefile8
-rw-r--r--fs/partitions/check.c6
-rw-r--r--fs/proc/Makefile11
-rw-r--r--fs/qnx4/Makefile5
-rw-r--r--fs/qnx4/inode.c2
-rw-r--r--fs/ramfs/Makefile5
-rw-r--r--fs/ramfs/inode.c11
-rw-r--r--fs/romfs/Makefile5
-rw-r--r--fs/romfs/inode.c2
-rw-r--r--fs/smbfs/Makefile5
-rw-r--r--fs/smbfs/file.c2
-rw-r--r--fs/sysv/Makefile5
-rw-r--r--fs/udf/Makefile5
-rw-r--r--fs/udf/file.c6
-rw-r--r--fs/udf/symlink.c2
-rw-r--r--fs/ufs/Makefile5
-rw-r--r--fs/umsdos/Makefile4
-rw-r--r--fs/vfat/Makefile8
-rw-r--r--fs/vfat/namei.c7
79 files changed, 439 insertions, 389 deletions
diff --git a/fs/Makefile b/fs/Makefile
index 5bed63c84..d63fd61bd 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -75,17 +75,4 @@ obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o))
-# Subdirectories that should be entered when MAKING_MODULES=1, even if set to 'y'.
-both-m := $(filter $(mod-subdirs), $(subdir-y))
-
-# Translate to Rules.make lists.
-O_OBJS := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS := $(filter $(export-objs), $(obj-y))
-M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
-
-SUB_DIRS := $(subdir-y)
-MOD_SUB_DIRS := $(sort $(subdir-m) $(both-m))
-ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
-
include $(TOPDIR)/Rules.make
diff --git a/fs/adfs/Makefile b/fs/adfs/Makefile
index 6ce002004..f1a279dde 100644
--- a/fs/adfs/Makefile
+++ b/fs/adfs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := adfs.o
-O_OBJS := dir.o dir_f.o dir_fplus.o file.o inode.o map.o super.o
-M_OBJS := $(O_TARGET)
+
+obj-y := dir.o dir_f.o dir_fplus.o file.o inode.o map.o super.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 161122650..b4ea3a1a9 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -66,7 +66,7 @@ static int adfs_readpage(struct file *file, struct page *page)
static int adfs_prepare_write(struct file *file, struct page *page, unsigned int from, unsigned int to)
{
return cont_prepare_write(page, from, to, adfs_get_block,
- &((struct inode *)page->mapping->host)->u.adfs_i.mmu_private);
+ &page->mapping->host->u.adfs_i.mmu_private);
}
static int _adfs_bmap(struct address_space *mapping, long block)
diff --git a/fs/affs/Makefile b/fs/affs/Makefile
index c0def3c92..122c4be7b 100644
--- a/fs/affs/Makefile
+++ b/fs/affs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := affs.o
-O_OBJS := super.o namei.o inode.o file.o dir.o amigaffs.o bitmap.o symlink.o
-M_OBJS := $(O_TARGET)
+
+obj-y := super.o namei.o inode.o file.o dir.o amigaffs.o bitmap.o symlink.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 341660c4b..fac21f70b 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -349,7 +349,7 @@ static int affs_readpage(struct file *file, struct page *page)
static int affs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,affs_get_block,
- &((struct inode*)page->mapping->host)->u.affs_i.mmu_private);
+ &page->mapping->host->u.affs_i.mmu_private);
}
static int _affs_bmap(struct address_space *mapping, long block)
{
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
index b125dee4e..78b7f147e 100644
--- a/fs/affs/symlink.c
+++ b/fs/affs/symlink.c
@@ -19,7 +19,7 @@
static int affs_symlink_readpage(struct file *file, struct page *page)
{
struct buffer_head *bh;
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
char *link = kmap(page);
struct slink_front *lf;
int err;
diff --git a/fs/autofs/Makefile b/fs/autofs/Makefile
index 1681c3d31..5c8dbcfe3 100644
--- a/fs/autofs/Makefile
+++ b/fs/autofs/Makefile
@@ -5,31 +5,8 @@
#
O_TARGET := autofs.o
-O_OBJS := dir.o dirhash.o init.o inode.o root.o symlink.o waitq.o
-M_OBJS := $(O_TARGET)
+obj-y := dir.o dirhash.o init.o inode.o root.o symlink.o waitq.o
+obj-m := $(O_TARGET)
-ifdef TOPDIR
-#
-# Part of the kernel code
-#
include $(TOPDIR)/Rules.make
-else
-#
-# Standalone (handy for development)
-#
-include ../Makefile.rules
-
-CFLAGS += -D__KERNEL__ -DMODULE $(KFLAGS) -I../include -I$(KINCLUDE) $(MODFLAGS)
-
-all: $(O_TARGET)
-
-$(O_TARGET): $(O_OBJS)
- $(LD) -r -o $(O_TARGET) $(O_OBJS)
-
-install: $(O_TARGET)
- install -c $(O_TARGET) /lib/modules/`uname -r`/fs
-
-clean:
- rm -f *.o *.s
-endif
diff --git a/fs/autofs4/Makefile b/fs/autofs4/Makefile
index 3e3f2cc22..1eb09f0bf 100644
--- a/fs/autofs4/Makefile
+++ b/fs/autofs4/Makefile
@@ -5,31 +5,9 @@
#
O_TARGET := autofs4.o
-O_OBJS := init.o inode.o root.o symlink.o waitq.o expire.o
-M_OBJS := $(O_TARGET)
+obj-y := init.o inode.o root.o symlink.o waitq.o expire.o
-ifdef TOPDIR
-#
-# Part of the kernel code
-#
-include $(TOPDIR)/Rules.make
-else
-#
-# Standalone (handy for development)
-#
-include ../Makefile.rules
+obj-m := $(O_TARGET)
-CFLAGS += -D__KERNEL__ -DMODULE $(KFLAGS) -I../include -I$(KINCLUDE) $(MODFLAGS)
-
-all: $(O_TARGET)
-
-$(O_TARGET): $(O_OBJS)
- $(LD) -r -o $(O_TARGET) $(O_OBJS)
-
-install: $(O_TARGET)
- install -c $(O_TARGET) /lib/modules/`uname -r`/fs
-
-clean:
- rm -f *.o *.s
-endif
+include $(TOPDIR)/Rules.make
diff --git a/fs/bfs/Makefile b/fs/bfs/Makefile
index 0aeda0cca..ff4d375dd 100644
--- a/fs/bfs/Makefile
+++ b/fs/bfs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main Makefile...
O_TARGET := bfs.o
-O_OBJS := inode.o file.o dir.o
-M_OBJS := $(O_TARGET)
+
+obj-y := inode.o file.o dir.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/buffer.c b/fs/buffer.c
index 8e2a382c3..601276bbc 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -122,16 +122,17 @@ union bdflush_param {
when trying to refill buffers. */
int interval; /* jiffies delay between kupdate flushes */
int age_buffer; /* Time for normal buffer to age before we flush it */
- int dummy1; /* unused, was age_super */
+ int nfract_sync; /* Percentage of buffer cache dirty to
+ activate bdflush synchronously */
int dummy2; /* unused */
int dummy3; /* unused */
} b_un;
unsigned int data[N_PARAM];
-} bdf_prm = {{40, 500, 64, 256, 5*HZ, 30*HZ, 5*HZ, 1884, 2}};
+} bdf_prm = {{40, 500, 64, 256, 5*HZ, 30*HZ, 80, 0, 0}};
/* These are the min and max parameter values that we will allow to be assigned */
-int bdflush_min[N_PARAM] = { 0, 10, 5, 25, 0, 1*HZ, 1*HZ, 1, 1};
-int bdflush_max[N_PARAM] = {100,50000, 20000, 20000,600*HZ, 6000*HZ, 6000*HZ, 2047, 5};
+int bdflush_min[N_PARAM] = { 0, 10, 5, 25, 0, 1*HZ, 0, 0, 0};
+int bdflush_max[N_PARAM] = {100,50000, 20000, 20000,600*HZ, 6000*HZ, 100, 0, 0};
/*
* Rewrote the wait-routines to use the "new" wait-queue functionality,
@@ -337,9 +338,10 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
/* sync the superblock to buffers */
sb = inode->i_sb;
- wait_on_super(sb);
+ lock_super(sb);
if (sb->s_op && sb->s_op->write_super)
sb->s_op->write_super(sb);
+ unlock_super(sb);
/* .. finally sync the buffers to disk */
dev = inode->i_dev;
@@ -369,7 +371,9 @@ asmlinkage long sys_fsync(unsigned int fd)
/* We need to protect against concurrent writers.. */
down(&inode->i_sem);
+ filemap_fdatasync(inode->i_mapping);
err = file->f_op->fsync(file, dentry, 0);
+ filemap_fdatawait(inode->i_mapping);
up(&inode->i_sem);
out_putf:
@@ -398,7 +402,9 @@ asmlinkage long sys_fdatasync(unsigned int fd)
goto out_putf;
down(&inode->i_sem);
+ filemap_fdatasync(inode->i_mapping);
err = file->f_op->fsync(file, dentry, 1);
+ filemap_fdatawait(inode->i_mapping);
up(&inode->i_sem);
out_putf:
@@ -639,8 +645,13 @@ void __invalidate_buffers(kdev_t dev, int destroy_dirty_buffers)
continue;
for (i = nr_buffers_type[nlist]; i > 0 ; bh = bh_next, i--) {
bh_next = bh->b_next_free;
+
+ /* Another device? */
if (bh->b_dev != dev)
continue;
+ /* Part of a mapping? */
+ if (bh->b_page->mapping)
+ continue;
if (buffer_locked(bh)) {
atomic_inc(&bh->b_count);
spin_unlock(&lru_list_lock);
@@ -758,13 +769,6 @@ void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
bh->b_private = private;
}
-static void end_buffer_io_bad(struct buffer_head *bh, int uptodate)
-{
- mark_buffer_uptodate(bh, uptodate);
- unlock_buffer(bh);
- BUG();
-}
-
static void end_buffer_io_async(struct buffer_head * bh, int uptodate)
{
static spinlock_t page_uptodate_lock = SPIN_LOCK_UNLOCKED;
@@ -995,7 +999,7 @@ repeat:
* and it is clean.
*/
if (bh) {
- init_buffer(bh, end_buffer_io_bad, NULL);
+ init_buffer(bh, NULL, NULL);
bh->b_dev = dev;
bh->b_blocknr = block;
bh->b_state = 1 << BH_Mapped;
@@ -1030,9 +1034,9 @@ int balance_dirty_state(kdev_t dev)
dirty = size_buffers_type[BUF_DIRTY] >> PAGE_SHIFT;
tot = nr_free_buffer_pages();
- dirty *= 200;
+ dirty *= 100;
soft_dirty_limit = tot * bdf_prm.b_un.nfract;
- hard_dirty_limit = soft_dirty_limit * 2;
+ hard_dirty_limit = tot * bdf_prm.b_un.nfract_sync;
/* First, check for the "real" dirty limit. */
if (dirty > soft_dirty_limit) {
@@ -1305,7 +1309,7 @@ try_again:
set_bh_page(bh, page, offset);
bh->b_list = BUF_CLEAN;
- bh->b_end_io = end_buffer_io_bad;
+ bh->b_end_io = NULL;
}
return head;
/*
@@ -1426,7 +1430,7 @@ static void create_empty_buffers(struct page *page, kdev_t dev, unsigned long bl
do {
bh->b_dev = dev;
bh->b_blocknr = 0;
- bh->b_end_io = end_buffer_io_bad;
+ bh->b_end_io = NULL;
tail = bh;
bh = bh->b_this_page;
} while (bh);
@@ -1519,13 +1523,13 @@ static int __block_write_full_page(struct inode *inode, struct page *page, get_b
block++;
} while (bh != head);
- /* Stage 2: lock the buffers, mark them dirty */
+ /* Stage 2: lock the buffers, mark them clean */
do {
lock_buffer(bh);
bh->b_end_io = end_buffer_io_async;
atomic_inc(&bh->b_count);
set_bit(BH_Uptodate, &bh->b_state);
- set_bit(BH_Dirty, &bh->b_state);
+ clear_bit(BH_Dirty, &bh->b_state);
bh = bh->b_this_page;
} while (bh != head);
@@ -1664,7 +1668,7 @@ static int __block_commit_write(struct inode *inode, struct page *page,
*/
int block_read_full_page(struct page *page, get_block_t *get_block)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
unsigned long iblock, lblock;
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
unsigned int blocksize, blocks;
@@ -1700,6 +1704,9 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
set_bit(BH_Uptodate, &bh->b_state);
continue;
}
+ /* get_block() might have updated the buffer synchronously */
+ if (buffer_uptodate(bh))
+ continue;
}
arr[nr] = bh;
@@ -1739,7 +1746,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
int cont_prepare_write(struct page *page, unsigned offset, unsigned to, get_block_t *get_block, unsigned long *bytes)
{
struct address_space *mapping = page->mapping;
- struct inode *inode = (struct inode*)mapping->host;
+ struct inode *inode = mapping->host;
struct page *new_page;
unsigned long pgpos;
long status;
@@ -1820,7 +1827,7 @@ out:
int block_prepare_write(struct page *page, unsigned from, unsigned to,
get_block_t *get_block)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
int err = __block_prepare_write(inode, page, from, to, get_block);
if (err) {
ClearPageUptodate(page);
@@ -1832,7 +1839,7 @@ int block_prepare_write(struct page *page, unsigned from, unsigned to,
int generic_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
__block_commit_write(inode,page,from,to);
kunmap(page);
@@ -1848,7 +1855,7 @@ int block_truncate_page(struct address_space *mapping, loff_t from, get_block_t
unsigned long index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE-1);
unsigned blocksize, iblock, length, pos;
- struct inode *inode = (struct inode *)mapping->host;
+ struct inode *inode = mapping->host;
struct page *page;
struct buffer_head *bh;
int err;
@@ -1908,7 +1915,7 @@ int block_truncate_page(struct address_space *mapping, loff_t from, get_block_t
flush_dcache_page(page);
kunmap(page);
- mark_buffer_dirty(bh);
+ __mark_buffer_dirty(bh);
err = 0;
unlock:
@@ -1920,7 +1927,7 @@ out:
int block_write_full_page(struct page *page, get_block_t *get_block)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
unsigned offset;
int err;
@@ -1955,7 +1962,7 @@ done:
int generic_block_bmap(struct address_space *mapping, long block, get_block_t *get_block)
{
struct buffer_head tmp;
- struct inode *inode = (struct inode*)mapping->host;
+ struct inode *inode = mapping->host;
tmp.b_state = 0;
tmp.b_blocknr = 0;
get_block(inode, block, &tmp, 0);
@@ -2097,7 +2104,7 @@ int brw_kiovec(int rw, int nr, struct kiobuf *iovec[],
if (rw == WRITE) {
set_bit(BH_Uptodate, &tmp->b_state);
- set_bit(BH_Dirty, &tmp->b_state);
+ clear_bit(BH_Dirty, &tmp->b_state);
}
bh[bhind++] = tmp;
diff --git a/fs/coda/Makefile b/fs/coda/Makefile
index 1faa42235..e169867ee 100644
--- a/fs/coda/Makefile
+++ b/fs/coda/Makefile
@@ -3,9 +3,10 @@
#
O_TARGET := coda.o
-O_OBJS := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o coda_linux.o\
- symlink.o pioctl.o sysctl.o
-M_OBJS := $(O_TARGET)
+
+obj-y := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o coda_linux.o\
+ symlink.o pioctl.o sysctl.o
+obj-m := $(O_TARGET)
# If you want debugging output, please uncomment the following line.
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index e1ab9e896..7011582fe 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -525,7 +525,7 @@ int coda_readdir(struct file *file, void *dirent, filldir_t filldir)
return -EIO;
}
- container = (struct inode *)inode->i_mapping->host;
+ container = inode->i_mapping->host;
coda_prepare_fakefile(inode, file, container, &open_file, &open_dentry);
@@ -614,7 +614,7 @@ int coda_open(struct inode *i, struct file *f)
f->private_data = cred;
if ( i->i_mapping != &i->i_data ) {
- old_container = (struct inode *)i->i_mapping->host;
+ old_container = i->i_mapping->host;
i->i_mapping = &i->i_data;
iput(old_container);
}
@@ -649,7 +649,7 @@ int coda_release(struct inode *i, struct file *f)
cred = (struct coda_cred *)f->private_data;
if (i->i_mapping != &i->i_data)
- container = (struct inode *)i->i_mapping->host;
+ container = i->i_mapping->host;
cii = ITOC(i);
CDEBUG(D_FILE, "RELEASE coda (ino %ld, ct %d, cc %d) cache (ino %ld, ct %d)\n",
@@ -922,7 +922,7 @@ ok:
return_bad_inode:
if ( inode->i_mapping != &inode->i_data ) {
- container = (struct inode *)inode->i_mapping->host;
+ container = inode->i_mapping->host;
inode->i_mapping = &inode->i_data;
iput(container);
}
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 0344c2072..94c54ecd9 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -29,7 +29,7 @@ static ssize_t
coda_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
- struct inode *container = (struct inode*)inode->i_mapping->host;
+ struct inode *container = inode->i_mapping->host;
ssize_t n;
down(&container->i_sem);
@@ -60,7 +60,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
return -1;
}
- cont_dentry.d_inode = (struct inode *)inode->i_mapping->host;
+ cont_dentry.d_inode = inode->i_mapping->host;
down(&cont_dentry.d_inode->i_sem);
result = file_fsync(NULL, &cont_dentry, datasync);
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 45acf28c6..3cf258a23 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -231,7 +231,7 @@ static void coda_clear_inode(struct inode *inode)
goto out;
if ( inode->i_mapping != &inode->i_data ) {
- open_inode = (struct inode *)inode->i_mapping->host;
+ open_inode = inode->i_mapping->host;
CDEBUG(D_SUPER, "DELINO cached file: ino %ld count %d.\n",
open_inode->i_ino, atomic_read(&open_inode->i_count));
inode->i_mapping = &inode->i_data;
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c
index 2df6cf719..018c4410b 100644
--- a/fs/coda/symlink.c
+++ b/fs/coda/symlink.c
@@ -24,7 +24,7 @@
static int coda_symlink_filler(struct file *file, struct page *page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
int error;
struct coda_inode_info *cnp;
unsigned int len = PAGE_SIZE;
diff --git a/fs/cramfs/Makefile b/fs/cramfs/Makefile
index 9f71d0814..3db73d8ac 100644
--- a/fs/cramfs/Makefile
+++ b/fs/cramfs/Makefile
@@ -4,9 +4,9 @@
O_TARGET := cramfs.o
-O_OBJS := inode.o uncompress.o inflate/zlib.o
+obj-y := inode.o uncompress.o inflate/zlib.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/cramfs/inflate/Makefile b/fs/cramfs/inflate/Makefile
index 92feb8325..5d89dc3c9 100644
--- a/fs/cramfs/inflate/Makefile
+++ b/fs/cramfs/inflate/Makefile
@@ -28,7 +28,7 @@
O_TARGET := zlib.o
-O_OBJS := adler32.o infblock.o infcodes.o inffast.o inflate.o \
- inftrees.o infutil.o uncompr.o
+obj-y := adler32.o infblock.o infcodes.o inffast.o inflate.o \
+ inftrees.o infutil.o uncompr.o
include $(TOPDIR)/Rules.make
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 51eff1caa..3ce1b2e01 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -306,7 +306,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry)
static int cramfs_readpage(struct file *file, struct page * page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
u32 maxblock, bytes_filled;
maxblock = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
diff --git a/fs/devfs/Makefile b/fs/devfs/Makefile
index 23f190410..b551ffd09 100644
--- a/fs/devfs/Makefile
+++ b/fs/devfs/Makefile
@@ -8,7 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := devfs.o
-OX_OBJS := base.o util.o
+
+export-objs := base.o util.o
+
+obj-y := base.o util.o
# Special case to support building documentation
ifndef TOPDIR
diff --git a/fs/devpts/Makefile b/fs/devpts/Makefile
index 2e0c75d74..8ab293007 100644
--- a/fs/devpts/Makefile
+++ b/fs/devpts/Makefile
@@ -3,8 +3,9 @@
#
O_TARGET := devpts.o
-O_OBJS := root.o inode.o
-M_OBJS := $(O_TARGET)
+obj-y := root.o inode.o
+
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/efs/Makefile b/fs/efs/Makefile
index e41be23f1..9352c722b 100644
--- a/fs/efs/Makefile
+++ b/fs/efs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := efs.o
-O_OBJS := super.o inode.o namei.o dir.o file.o symlink.o
-M_OBJS := $(O_TARGET)
+
+obj-y := super.o inode.o namei.o dir.o file.o symlink.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index d1c788cc2..b5d17f3cc 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -15,7 +15,7 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
{
char *link = kmap(page);
struct buffer_head * bh;
- struct inode * inode = (struct inode*)page->mapping->host;
+ struct inode * inode = page->mapping->host;
efs_block_t size = inode->i_size;
int err;
diff --git a/fs/exec.c b/fs/exec.c
index f04fab7e3..36f3a8c6e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -223,8 +223,6 @@ int copy_strings(int argc,char ** argv, struct linux_binprm *bprm)
memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
}
err = copy_from_user(kaddr + offset, str, bytes_to_copy);
- flush_dcache_page(page);
- flush_page_to_ram(page);
kunmap(page);
if (err)
@@ -281,6 +279,7 @@ void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long a
__free_page(page);
return;
}
+ flush_dcache_page(page);
flush_page_to_ram(page);
set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, PAGE_COPY))));
/* no need for flush_tlb */
@@ -314,9 +313,7 @@ int setup_arg_pages(struct linux_binprm *bprm)
mpnt->vm_pgoff = 0;
mpnt->vm_file = NULL;
mpnt->vm_private_data = (void *) 0;
- spin_lock(&current->mm->page_table_lock);
insert_vm_struct(current->mm, mpnt);
- spin_unlock(&current->mm->page_table_lock);
current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
}
@@ -597,7 +594,6 @@ static inline int must_not_trace_exec(struct task_struct * p)
int prepare_binprm(struct linux_binprm *bprm)
{
int mode;
- int id_change,cap_raised;
struct inode * inode = bprm->file->f_dentry->d_inode;
mode = inode->i_mode;
@@ -609,25 +605,20 @@ int prepare_binprm(struct linux_binprm *bprm)
bprm->e_uid = current->euid;
bprm->e_gid = current->egid;
- id_change = cap_raised = 0;
- /* Set-uid? */
- if (mode & S_ISUID) {
- bprm->e_uid = inode->i_uid;
- if (bprm->e_uid != current->euid)
- id_change = 1;
- }
-
- /* Set-gid? */
- /*
- * If setgid is set but no group execute bit then this
- * is a candidate for mandatory locking, not a setgid
- * executable.
- */
- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
- bprm->e_gid = inode->i_gid;
- if (!in_group_p(bprm->e_gid))
- id_change = 1;
+ if(!IS_NOSUID(inode)) {
+ /* Set-uid? */
+ if (mode & S_ISUID)
+ bprm->e_uid = inode->i_uid;
+
+ /* Set-gid? */
+ /*
+ * If setgid is set but no group execute bit then this
+ * is a candidate for mandatory locking, not a setgid
+ * executable.
+ */
+ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))
+ bprm->e_gid = inode->i_gid;
}
/* We don't have VFS support for capabilities yet */
@@ -652,39 +643,6 @@ int prepare_binprm(struct linux_binprm *bprm)
cap_set_full(bprm->cap_effective);
}
- /* Only if pP' is _not_ a subset of pP, do we consider there
- * has been a capability related "change of capability". In
- * such cases, we need to check that the elevation of
- * privilege does not go against other system constraints.
- * The new Permitted set is defined below -- see (***). */
- {
- kernel_cap_t permitted, working;
-
- permitted = cap_intersect(bprm->cap_permitted, cap_bset);
- working = cap_intersect(bprm->cap_inheritable,
- current->cap_inheritable);
- working = cap_combine(permitted, working);
- if (!cap_issubset(working, current->cap_permitted)) {
- cap_raised = 1;
- }
- }
-
- if (id_change || cap_raised) {
- /* We can't suid-execute if we're sharing parts of the executable */
- /* or if we're being traced (or if suid execs are not allowed) */
- /* (current->mm->mm_users > 1 is ok, as we'll get a new mm anyway) */
- if (IS_NOSUID(inode)
- || must_not_trace_exec(current)
- || (atomic_read(&current->fs->count) > 1)
- || (atomic_read(&current->sig->count) > 1)
- || (atomic_read(&current->files->count) > 1)) {
- if (id_change && !capable(CAP_SETUID))
- return -EPERM;
- if (cap_raised && !capable(CAP_SETPCAP))
- return -EPERM;
- }
- }
-
memset(bprm->buf,0,BINPRM_BUF_SIZE);
return kernel_read(bprm->file,0,bprm->buf,BINPRM_BUF_SIZE);
}
@@ -701,17 +659,41 @@ int prepare_binprm(struct linux_binprm *bprm)
*
* I=Inheritable, P=Permitted, E=Effective // p=process, f=file
* ' indicates post-exec(), and X is the global 'cap_bset'.
+ *
*/
void compute_creds(struct linux_binprm *bprm)
{
kernel_cap_t new_permitted, working;
+ int do_unlock = 0;
new_permitted = cap_intersect(bprm->cap_permitted, cap_bset);
working = cap_intersect(bprm->cap_inheritable,
current->cap_inheritable);
new_permitted = cap_combine(new_permitted, working);
+ if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
+ !cap_issubset(new_permitted, current->cap_permitted)) {
+ current->dumpable = 0;
+
+ lock_kernel();
+ if (must_not_trace_exec(current)
+ || atomic_read(&current->fs->count) > 1
+ || atomic_read(&current->files->count) > 1
+ || atomic_read(&current->sig->count) > 1) {
+ if(!capable(CAP_SETUID)) {
+ bprm->e_uid = current->uid;
+ bprm->e_gid = current->gid;
+ }
+ if(!capable(CAP_SETPCAP)) {
+ new_permitted = cap_intersect(new_permitted,
+ current->cap_permitted);
+ }
+ }
+ do_unlock = 1;
+ }
+
+
/* For init, we want to retain the capabilities set
* in the init_task struct. Thus we skip the usual
* capability rules */
@@ -725,10 +707,9 @@ void compute_creds(struct linux_binprm *bprm)
current->suid = current->euid = current->fsuid = bprm->e_uid;
current->sgid = current->egid = current->fsgid = bprm->e_gid;
- if (current->euid != current->uid || current->egid != current->gid ||
- !cap_issubset(new_permitted, current->cap_permitted))
- current->dumpable = 0;
+ if(do_unlock)
+ unlock_kernel();
current->keep_capabilities = 0;
}
@@ -768,29 +749,26 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
/* handle /sbin/loader.. */
{
struct exec * eh = (struct exec *) bprm->buf;
- struct linux_binprm bprm_loader;
if (!bprm->loader && eh->fh.f_magic == 0x183 &&
(eh->fh.f_flags & 0x3000) == 0x3000)
{
- int i;
char * dynloader[] = { "/sbin/loader" };
struct file * file;
+ unsigned long loader;
allow_write_access(bprm->file);
fput(bprm->file);
bprm->file = NULL;
- bprm_loader.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- for (i = 0 ; i < MAX_ARG_PAGES ; i++) /* clear page-table */
- bprm_loader.page[i] = NULL;
+ loader = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
file = open_exec(dynloader[0]);
retval = PTR_ERR(file);
if (IS_ERR(file))
return retval;
bprm->file = file;
- bprm->loader = bprm_loader.p;
+ bprm->loader = loader;
retval = prepare_binprm(bprm);
if (retval<0)
return retval;
diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile
index 7321f45c8..aa8560f07 100644
--- a/fs/ext2/Makefile
+++ b/fs/ext2/Makefile
@@ -8,8 +8,9 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := ext2.o
-O_OBJS := acl.o balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+
+obj-y := acl.o balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 81448e71b..e592850db 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -663,7 +663,7 @@ static inline int block_in_use (unsigned long block,
EXT2_BLOCKS_PER_GROUP(sb), map);
}
-static int test_root(int a, int b)
+static inline int test_root(int a, int b)
{
if (a == 0)
return 1;
@@ -682,24 +682,55 @@ int ext2_group_sparse(int group)
test_root(group, 7));
}
+/**
+ * ext2_bg_has_super - number of blocks used by the superblock in group
+ * @sb: superblock for filesystem
+ * @group: group number to check
+ *
+ * Return the number of blocks used by the superblock (primary or backup)
+ * in this group. Currently this will be only 0 or 1.
+ */
+int ext2_bg_has_super(struct super_block *sb, int group)
+{
+ if (EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)&&
+ !ext2_group_sparse(group))
+ return 0;
+ return 1;
+}
+
+/**
+ * ext2_bg_num_gdb - number of blocks used by the group table in group
+ * @sb: superblock for filesystem
+ * @group: group number to check
+ *
+ * Return the number of blocks used by the group descriptor table
+ * (primary or backup) in this group. In the future there may be a
+ * different number of descriptor blocks in each group.
+ */
+unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
+{
+ if (EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)&&
+ !ext2_group_sparse(group))
+ return 0;
+ return EXT2_SB(sb)->s_gdb_count;
+}
+
#ifdef CONFIG_EXT2_CHECK
/* Called at mount-time, super-block is locked */
void ext2_check_blocks_bitmap (struct super_block * sb)
{
struct buffer_head * bh;
struct ext2_super_block * es;
- unsigned long desc_count, bitmap_count, x;
+ unsigned long desc_count, bitmap_count, x, j;
unsigned long desc_blocks;
int bitmap_nr;
struct ext2_group_desc * gdp;
- int i, j;
+ int i;
es = sb->u.ext2_sb.s_es;
desc_count = 0;
bitmap_count = 0;
gdp = NULL;
- desc_blocks = (sb->u.ext2_sb.s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) /
- EXT2_DESC_PER_BLOCK(sb);
for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) {
gdp = ext2_get_group_desc (sb, i, NULL);
if (!gdp)
@@ -708,24 +739,19 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
bitmap_nr = load_block_bitmap (sb, i);
if (bitmap_nr < 0)
continue;
-
- bh = sb->u.ext2_sb.s_block_bitmap[bitmap_nr];
- if (!(sb->u.ext2_sb.s_feature_ro_compat &
- EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) ||
- ext2_group_sparse(i)) {
- if (!ext2_test_bit (0, bh->b_data))
- ext2_error (sb, "ext2_check_blocks_bitmap",
- "Superblock in group %d "
- "is marked free", i);
-
- for (j = 0; j < desc_blocks; j++)
- if (!ext2_test_bit (j + 1, bh->b_data))
- ext2_error (sb,
- "ext2_check_blocks_bitmap",
- "Descriptor block #%d in group "
- "%d is marked free", j, i);
- }
+ bh = EXT2_SB(sb)->s_block_bitmap[bitmap_nr];
+
+ if (ext2_bg_has_super(sb, i) && !ext2_test_bit(0, bh->b_data))
+ ext2_error(sb, __FUNCTION__,
+ "Superblock in group %d is marked free", i);
+
+ desc_blocks = ext2_bg_num_gdb(sb, i);
+ for (j = 0; j < desc_blocks; j++)
+ if (!ext2_test_bit(j + 1, bh->b_data))
+ ext2_error(sb, __FUNCTION__,
+ "Descriptor block #%ld in group "
+ "%d is marked free", j, i);
if (!block_in_use (le32_to_cpu(gdp->bg_block_bitmap), sb, bh->b_data))
ext2_error (sb, "ext2_check_blocks_bitmap",
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 658a06416..fd54c3040 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1190,13 +1190,17 @@ static int ext2_update_inode(struct inode * inode, int do_sync)
raw_inode->i_size_high = cpu_to_le32(inode->i_size >> 32);
if (raw_inode->i_size_high) {
struct super_block *sb = inode->i_sb;
- struct ext2_super_block *es = sb->u.ext2_sb.s_es;
- if (!(es->s_feature_ro_compat & cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE))) {
+ if (!EXT2_HAS_RO_COMPAT_FEATURE(sb,
+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE) ||
+ EXT2_SB(sb)->s_es->s_rev_level ==
+ cpu_to_le32(EXT2_GOOD_OLD_REV)) {
/* If this is the first large file
* created, add a flag to the superblock.
*/
lock_kernel();
- es->s_feature_ro_compat |= cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE);
+ ext2_update_dynamic_rev(sb);
+ EXT2_SET_RO_COMPAT_FEATURE(sb,
+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE);
unlock_kernel();
ext2_write_super(sb);
}
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 4d2dfedbf..7b88355f8 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -95,6 +95,31 @@ void ext2_warning (struct super_block * sb, const char * function,
bdevname(sb->s_dev), function, error_buf);
}
+void ext2_update_dynamic_rev(struct super_block *sb)
+{
+ struct ext2_super_block *es = EXT2_SB(sb)->s_es;
+
+ if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV)
+ return;
+
+ ext2_warning(sb, __FUNCTION__,
+ "updating to rev %d because of new feature flag, "
+ "running e2fsck is recommended",
+ EXT2_DYNAMIC_REV);
+
+ es->s_first_ino = cpu_to_le32(EXT2_GOOD_OLD_FIRST_INO);
+ es->s_inode_size = cpu_to_le16(EXT2_GOOD_OLD_INODE_SIZE);
+ es->s_rev_level = cpu_to_le32(EXT2_DYNAMIC_REV);
+ /* leave es->s_feature_*compat flags alone */
+ /* es->s_uuid will be set by e2fsck if empty */
+
+ /*
+ * The rest of the superblock fields should be zero, and if not it
+ * means they are likely already in use, so leave them alone. We
+ * can leave it up to e2fsck to clean up any inconsistencies there.
+ */
+}
+
void ext2_put_super (struct super_block * sb)
{
int db_count;
@@ -104,7 +129,7 @@ void ext2_put_super (struct super_block * sb)
sb->u.ext2_sb.s_es->s_state = le16_to_cpu(sb->u.ext2_sb.s_mount_state);
mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
}
- db_count = sb->u.ext2_sb.s_db_per_group;
+ db_count = EXT2_SB(sb)->s_gdb_count;
for (i = 0; i < db_count; i++)
if (sb->u.ext2_sb.s_group_desc[i])
brelse (sb->u.ext2_sb.s_group_desc[i]);
@@ -261,9 +286,9 @@ static int ext2_setup_super (struct super_block * sb,
{
int res = 0;
if (le32_to_cpu(es->s_rev_level) > EXT2_MAX_SUPP_REV) {
- printk ("EXT2-fs warning: revision level too high, "
- "forcing read/only mode\n");
- res = MS_RDONLY;
+ printk ("EXT2-fs warning: revision level too high, "
+ "forcing read-only mode\n");
+ res = MS_RDONLY;
}
if (read_only)
return res;
@@ -423,22 +448,32 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
brelse(bh);
return NULL;
}
- if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) {
- if (le32_to_cpu(es->s_feature_incompat) & ~EXT2_FEATURE_INCOMPAT_SUPP) {
- printk("EXT2-fs: %s: couldn't mount because of "
- "unsupported optional features.\n",
- bdevname(dev));
- goto failed_mount;
- }
- if (!(sb->s_flags & MS_RDONLY) &&
- (le32_to_cpu(es->s_feature_ro_compat) & ~EXT2_FEATURE_RO_COMPAT_SUPP)) {
- printk("EXT2-fs: %s: couldn't mount RDWR because of "
- "unsupported optional features.\n",
- bdevname(dev));
- goto failed_mount;
- }
+ if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV &&
+ (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) ||
+ EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) ||
+ EXT2_HAS_INCOMPAT_FEATURE(sb, ~0U)))
+ printk("EXT2-fs warning: feature flags set on rev 0 fs, "
+ "running e2fsck is recommended\n");
+ /*
+ * Check feature flags regardless of the revision level, since we
+ * previously didn't change the revision level when setting the flags,
+ * so there is a chance incompat flags are set on a rev 0 filesystem.
+ */
+ if ((i = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP))) {
+ printk("EXT2-fs: %s: couldn't mount because of "
+ "unsupported optional features (%x).\n",
+ bdevname(dev), i);
+ goto failed_mount;
+ }
+ if (!(sb->s_flags & MS_RDONLY) &&
+ (i = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP))){
+ printk("EXT2-fs: %s: couldn't mount RDWR because of "
+ "unsupported optional features (%x).\n",
+ bdevname(dev), i);
+ goto failed_mount;
}
- sb->s_blocksize_bits = le32_to_cpu(sb->u.ext2_sb.s_es->s_log_block_size) + 10;
+ sb->s_blocksize_bits =
+ le32_to_cpu(EXT2_SB(sb)->s_es->s_log_block_size) + 10;
sb->s_blocksize = 1 << sb->s_blocksize_bits;
if (sb->s_blocksize != BLOCK_SIZE &&
(sb->s_blocksize == 1024 || sb->s_blocksize == 2048 ||
@@ -484,9 +519,6 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
goto failed_mount;
}
}
- sb->u.ext2_sb.s_feature_compat = le32_to_cpu(es->s_feature_compat);
- sb->u.ext2_sb.s_feature_incompat = le32_to_cpu(es->s_feature_incompat);
- sb->u.ext2_sb.s_feature_ro_compat = le32_to_cpu(es->s_feature_ro_compat);
sb->u.ext2_sb.s_frag_size = EXT2_MIN_FRAG_SIZE <<
le32_to_cpu(es->s_log_frag_size);
if (sb->u.ext2_sb.s_frag_size)
@@ -590,7 +622,7 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data,
}
sb->u.ext2_sb.s_loaded_inode_bitmaps = 0;
sb->u.ext2_sb.s_loaded_block_bitmaps = 0;
- sb->u.ext2_sb.s_db_per_group = db_count;
+ sb->u.ext2_sb.s_gdb_count = db_count;
/*
* set up enough so that it can read an inode
*/
@@ -683,6 +715,14 @@ int ext2_remount (struct super_block * sb, int * flags, char * data)
ext2_commit_super (sb, es);
}
else {
+ int ret;
+ if ((ret = EXT2_HAS_RO_COMPAT_FEATURE(sb,
+ ~EXT2_FEATURE_RO_COMPAT_SUPP))) {
+ printk("EXT2-fs: %s: couldn't remount RDWR because of "
+ "unsupported optional features (%x).\n",
+ bdevname(sb->s_dev), ret);
+ return -EROFS;
+ }
/*
* Mounting a RDONLY partition read-write, so reread and
* store the current valid flag. (It may have been changed
@@ -698,7 +738,7 @@ int ext2_remount (struct super_block * sb, int * flags, char * data)
int ext2_statfs (struct super_block * sb, struct statfs * buf)
{
unsigned long overhead;
- int ngroups, i;
+ int i;
if (test_opt (sb, MINIX_DF))
overhead = 0;
@@ -715,19 +755,12 @@ int ext2_statfs (struct super_block * sb, struct statfs * buf)
/*
* Add the overhead attributed to the superblock and
- * block group descriptors. If this is sparse
- * superblocks is turned on, then not all groups have
- * this.
+ * block group descriptors. If the sparse superblocks
+ * feature is turned on, then not all groups have this.
*/
- if (sb->u.ext2_sb.s_feature_ro_compat &
- EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) {
- ngroups = 0;
- for (i=0 ; i < sb->u.ext2_sb.s_groups_count; i++)
- if (ext2_group_sparse(i))
- ngroups++;
- } else
- ngroups = sb->u.ext2_sb.s_groups_count;
- overhead += ngroups * (1 + sb->u.ext2_sb.s_db_per_group);
+ for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++)
+ overhead += ext2_bg_has_super(sb, i) +
+ ext2_bg_num_gdb(sb, i);
/*
* Every block group has an inode bitmap, a block
diff --git a/fs/fat/Makefile b/fs/fat/Makefile
index 339250c7c..76368ae52 100644
--- a/fs/fat/Makefile
+++ b/fs/fat/Makefile
@@ -8,8 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := fat.o
-O_OBJS := buffer.o cache.o dir.o file.o inode.o misc.o tables.o cvf.o
-OX_OBJS := fatfs_syms.o
-M_OBJS := $(O_TARGET)
+
+export-objs := fatfs_syms.o
+
+obj-y := buffer.o cache.o dir.o file.o inode.o misc.o tables.o cvf.o fatfs_syms.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index fd3746920..0cc0ee242 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -70,7 +70,7 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
}
if (MSDOS_SB(sb)->fat_bits == 32) {
p_first = p_last = NULL; /* GCC needs that stuff */
- next = CF_LE_L(((unsigned long *) bh->b_data)[(first &
+ next = CF_LE_L(((__u32 *) bh->b_data)[(first &
(SECTOR_SIZE-1)) >> 2]);
/* Fscking Microsoft marketing department. Their "32" is 28. */
next &= 0xfffffff;
@@ -79,12 +79,12 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
} else if (MSDOS_SB(sb)->fat_bits == 16) {
p_first = p_last = NULL; /* GCC needs that stuff */
- next = CF_LE_W(((unsigned short *) bh->b_data)[(first &
+ next = CF_LE_W(((__u16 *) bh->b_data)[(first &
(SECTOR_SIZE-1)) >> 1]);
if (next >= 0xfff7) next = -1;
} else {
- p_first = &((unsigned char *) bh->b_data)[first & (SECTOR_SIZE-1)];
- p_last = &((unsigned char *) bh2->b_data)[(first+1) &
+ p_first = &((__u8 *) bh->b_data)[first & (SECTOR_SIZE-1)];
+ p_last = &((__u8 *) bh2->b_data)[(first+1) &
(SECTOR_SIZE-1)];
if (nr & 1) next = ((*p_first >> 4) | (*p_last << 4)) & 0xfff;
else next = (*p_first+(*p_last << 8)) & 0xfff;
@@ -92,10 +92,10 @@ int default_fat_access(struct super_block *sb,int nr,int new_value)
}
if (new_value != -1) {
if (MSDOS_SB(sb)->fat_bits == 32) {
- ((unsigned long *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+ ((__u32 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
2] = CT_LE_L(new_value);
} else if (MSDOS_SB(sb)->fat_bits == 16) {
- ((unsigned short *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+ ((__u16 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
1] = CT_LE_W(new_value);
} else {
if (nr & 1) {
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 82f58826d..f13260966 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -746,7 +746,7 @@ static int fat_readpage(struct file *file, struct page *page)
static int fat_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,fat_get_block,
- &MSDOS_I((struct inode*)page->mapping->host)->mmu_private);
+ &MSDOS_I(page->mapping->host)->mmu_private);
}
static int _fat_bmap(struct address_space *mapping, long block)
{
@@ -904,6 +904,12 @@ int fat_notify_change(struct dentry * dentry, struct iattr * attr)
struct inode *inode = dentry->d_inode;
int error;
+ /* FAT cannot truncate to a longer file */
+ if (attr->ia_valid & ATTR_SIZE) {
+ if (attr->ia_size > inode->i_size)
+ return -EPERM;
+ }
+
error = inode_change_ok(inode, attr);
if (error)
return MSDOS_SB(sb)->options.quiet ? 0 : error;
diff --git a/fs/hfs/Makefile b/fs/hfs/Makefile
index 238bbba81..fd5a7589c 100644
--- a/fs/hfs/Makefile
+++ b/fs/hfs/Makefile
@@ -8,11 +8,12 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := hfs.o
-O_OBJS := balloc.o bdelete.o bfind.o bins_del.o binsert.o bitmap.o bitops.o \
+
+obj-y := balloc.o bdelete.o bfind.o bins_del.o binsert.o bitmap.o bitops.o \
bnode.o brec.o btree.o catalog.o dir.o dir_cap.o dir_dbl.o \
dir_nat.o extent.o file.o file_cap.o file_hdr.o inode.o mdb.o \
part_tbl.o string.o super.o sysdep.o trans.o version.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 7414a4c29..327125506 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -231,7 +231,7 @@ static int hfs_readpage(struct file *file, struct page *page)
static int hfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,hfs_get_block,
- &((struct inode*)page->mapping->host)->u.hfs_i.mmu_private);
+ &page->mapping->host->u.hfs_i.mmu_private);
}
static int hfs_bmap(struct address_space *mapping, long block)
{
diff --git a/fs/hpfs/Makefile b/fs/hpfs/Makefile
index 2ebaece02..b2394dedd 100644
--- a/fs/hpfs/Makefile
+++ b/fs/hpfs/Makefile
@@ -1,5 +1,6 @@
O_TARGET := hpfs.o
-O_OBJS := alloc.o anode.o buffer.o dentry.o dir.o dnode.o ea.o file.o inode.o map.o name.o namei.o super.o
-M_OBJS := $(O_TARGET)
+
+obj-y := alloc.o anode.o buffer.o dentry.o dir.o dnode.o ea.o file.o inode.o map.o name.o namei.o super.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index a9675ef54..4c0306815 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -104,7 +104,7 @@ static int hpfs_readpage(struct file *file, struct page *page)
static int hpfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,hpfs_get_block,
- &((struct inode*)page->mapping->host)->u.hpfs_i.mmu_private);
+ &page->mapping->host->u.hpfs_i.mmu_private);
}
static int _hpfs_bmap(struct address_space *mapping, long block)
{
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 0d38b408c..094767362 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -402,7 +402,7 @@ int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
int hpfs_symlink_readpage(struct file *file, struct page *page)
{
char *link = kmap(page);
- struct inode *i = (struct inode*)page->mapping->host;
+ struct inode *i = page->mapping->host;
struct fnode *fnode;
struct buffer_head *bh;
int err;
diff --git a/fs/inode.c b/fs/inode.c
index abbc04f1c..1d2b23b70 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -100,7 +100,9 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
memset(inode, 0, sizeof(*inode));
init_waitqueue_head(&inode->i_wait);
INIT_LIST_HEAD(&inode->i_hash);
- INIT_LIST_HEAD(&inode->i_data.pages);
+ INIT_LIST_HEAD(&inode->i_data.clean_pages);
+ INIT_LIST_HEAD(&inode->i_data.dirty_pages);
+ INIT_LIST_HEAD(&inode->i_data.locked_pages);
INIT_LIST_HEAD(&inode->i_dentry);
INIT_LIST_HEAD(&inode->i_dirty_buffers);
sema_init(&inode->i_sem, 1);
@@ -198,16 +200,25 @@ static inline void sync_one(struct inode *inode, int sync)
iput(inode);
spin_lock(&inode_lock);
} else {
+ unsigned dirty;
+
list_del(&inode->i_list);
list_add(&inode->i_list, atomic_read(&inode->i_count)
? &inode_in_use
: &inode_unused);
/* Set I_LOCK, reset I_DIRTY */
+ dirty = inode->i_state & I_DIRTY;
inode->i_state |= I_LOCK;
inode->i_state &= ~I_DIRTY;
spin_unlock(&inode_lock);
- write_inode(inode, sync);
+ filemap_fdatasync(inode->i_mapping);
+
+ /* Don't write the inode if only I_DIRTY_PAGES was set */
+ if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC))
+ write_inode(inode, sync);
+
+ filemap_fdatawait(inode->i_mapping);
spin_lock(&inode_lock);
inode->i_state &= ~I_LOCK;
@@ -595,7 +606,7 @@ static void clean_inode(struct inode *inode)
inode->i_pipe = NULL;
inode->i_bdev = NULL;
inode->i_data.a_ops = &empty_aops;
- inode->i_data.host = (void*)inode;
+ inode->i_data.host = inode;
inode->i_mapping = &inode->i_data;
}
diff --git a/fs/isofs/Makefile b/fs/isofs/Makefile
index b6cbdc6af..186492b5b 100644
--- a/fs/isofs/Makefile
+++ b/fs/isofs/Makefile
@@ -8,12 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := isofs.o
-O_OBJS := namei.o inode.o dir.o util.o rock.o
-ifdef CONFIG_JOLIET
-O_OBJS += joliet.o
-endif
+obj-y := namei.o inode.o dir.o util.o rock.o
+obj-$(CONFIG_JOLIET) += joliet.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 4ac4bc0ce..e20f3ad61 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -437,7 +437,7 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr)
static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
char *link = kmap(page);
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
unsigned char bufbits = ISOFS_BUFFER_BITS(inode);
diff --git a/fs/jffs/Makefile b/fs/jffs/Makefile
index 541816171..29bc24d6f 100644
--- a/fs/jffs/Makefile
+++ b/fs/jffs/Makefile
@@ -30,7 +30,7 @@ endif
endif
O_TARGET := jffs.o
-M_OBJS := $(O_TARGET)
-O_OBJS := jffs_fm.o intrep.o $(INODE_O)
+obj-m := $(O_TARGET)
+obj-y := jffs_fm.o intrep.o $(INODE_O)
include $(TOPDIR)/Rules.make
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index f61005aac..94fd0797d 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -697,7 +697,7 @@ jffs_readpage(struct file *file, struct page *page)
void *buf;
unsigned long read_len;
int result = -EIO;
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
struct jffs_file *f = (struct jffs_file *)inode->u.generic_ip;
struct jffs_control *c = (struct jffs_control *)inode->i_sb->u.generic_sbp;
int r;
diff --git a/fs/lockd/Makefile b/fs/lockd/Makefile
index ceab1f466..98f4ae531 100644
--- a/fs/lockd/Makefile
+++ b/fs/lockd/Makefile
@@ -8,14 +8,14 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := lockd.o
-O_OBJS := clntlock.o clntproc.o host.o svc.o svclock.o svcshare.o \
- svcproc.o svcsubs.o mon.o xdr.o
-ifdef CONFIG_LOCKD_V4
- O_OBJS += xdr4.o svc4proc.o
-endif
+export-objs := lockd_syms.o
-OX_OBJS := lockd_syms.o
-M_OBJS := $(O_TARGET)
+obj-y := clntlock.o clntproc.o host.o svc.o svclock.o svcshare.o \
+ svcproc.o svcsubs.o mon.o xdr.o lockd_syms.o
+
+obj-$(CONFIG_LOCKD_V4) += xdr4.o svc4proc.o
+
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 951ecbeaa..924741f9e 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -312,7 +312,6 @@ out:
#ifdef MODULE
/* New module support in 2.1.18 */
-EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
MODULE_DESCRIPTION("NFS file locking service version " LOCKD_VERSION ".");
MODULE_PARM(nlm_grace_period, "10-240l");
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index 739387ab9..78e783974 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -167,13 +167,14 @@ nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
|| (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
return NULL;
+ *p++ = htonl(fl->fl_pid);
+
start = loff_t_to_s64(fl->fl_start);
if (fl->fl_end == OFFSET_MAX)
len = 0;
else
len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1);
- *p++ = htonl(fl->fl_pid);
p = xdr_encode_hyper(p, start);
p = xdr_encode_hyper(p, len);
diff --git a/fs/minix/Makefile b/fs/minix/Makefile
index 13841d16a..135056181 100644
--- a/fs/minix/Makefile
+++ b/fs/minix/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := minix.o
-O_OBJS := bitmap.o itree_v1.o itree_v2.o namei.o inode.o file.o dir.o
-M_OBJS := $(O_TARGET)
+
+obj-y := bitmap.o itree_v1.o itree_v2.o namei.o inode.o file.o dir.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/msdos/Makefile b/fs/msdos/Makefile
index 01a5ebdc1..a0424c507 100644
--- a/fs/msdos/Makefile
+++ b/fs/msdos/Makefile
@@ -8,8 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := msdos.o
-O_OBJS := namei.o
-OX_OBJS := msdosfs_syms.o
-M_OBJS := $(O_TARGET)
+
+export-objs := msdosfs_syms.o
+
+obj-y := namei.o msdosfs_syms.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/namei.c b/fs/namei.c
index 37644f4a1..105833e4e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1611,7 +1611,7 @@ asmlinkage long sys_link(const char * oldname, const char * newname)
goto out;
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
- goto out;
+ goto out_release;
new_dentry = lookup_create(&nd, 0);
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
@@ -1619,6 +1619,7 @@ asmlinkage long sys_link(const char * oldname, const char * newname)
dput(new_dentry);
}
up(&nd.dentry->d_inode->i_sem);
+out_release:
path_release(&nd);
out:
path_release(&old_nd);
diff --git a/fs/ncpfs/Makefile b/fs/ncpfs/Makefile
index 2fb40609c..f30dfb671 100644
--- a/fs/ncpfs/Makefile
+++ b/fs/ncpfs/Makefile
@@ -8,9 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := ncpfs.o
-O_OBJS := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o \
+
+obj-y := dir.o file.o inode.o ioctl.o mmap.o ncplib_kernel.o sock.o \
symlink.o ncpsign_kernel.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
# If you want debugging output, please uncomment the following line
# EXTRA_CFLAGS += -DDEBUG_NCP=1
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c
index 022cbce78..52f095848 100644
--- a/fs/ncpfs/symlink.c
+++ b/fs/ncpfs/symlink.c
@@ -45,7 +45,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry,
static int ncp_symlink_readpage(struct file *file, struct page *page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
int error, length, len, cnt;
char *link;
char *buf = kmap(page);
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 52283d234..45fa64168 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -8,16 +8,13 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := nfs.o
-O_OBJS := inode.o file.o read.o write.o dir.o symlink.o proc.o \
+
+obj-y := inode.o file.o read.o write.o dir.o symlink.o proc.o \
nfs2xdr.o flushd.o unlink.o
-ifdef CONFIG_ROOT_NFS
- O_OBJS += nfsroot.o mount_clnt.o
-endif
-ifdef CONFIG_NFS_V3
- O_OBJS += nfs3proc.o nfs3xdr.o
-endif
+obj-$(CONFIG_ROOT_NFS) += nfsroot.o mount_clnt.o
+obj-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index d5c92ba3b..2b3f22777 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -161,7 +161,7 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse
{
long status;
loff_t pos = ((loff_t)page->index<<PAGE_CACHE_SHIFT) + to;
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
kunmap(page);
lock_kernel();
@@ -188,7 +188,7 @@ static int nfs_sync_page(struct page *page)
mapping = page->mapping;
if (!mapping)
return 0;
- inode = (struct inode *)mapping->host;
+ inode = mapping->host;
if (!inode)
return 0;
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index e0f7313be..211d3a3db 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -479,7 +479,7 @@ nfs_readpage(struct file *file, struct page *page)
struct address_space *mapping = page->mapping;
if (!mapping)
BUG();
- inode = (struct inode *)mapping->host;
+ inode = mapping->host;
} else
inode = file->f_dentry->d_inode;
if (!inode)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f75190be5..8b9a28556 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -263,7 +263,7 @@ nfs_writepage(struct page *page)
if (!mapping)
BUG();
- inode = (struct inode *)mapping->host;
+ inode = mapping->host;
if (!inode)
BUG();
end_index = inode->i_size >> PAGE_CACHE_SHIFT;
diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile
index 152a8b0b2..17775d0fb 100644
--- a/fs/nfsd/Makefile
+++ b/fs/nfsd/Makefile
@@ -8,13 +8,13 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := nfsd.o
-O_OBJS := nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
+
+obj-y := nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o nfsxdr.o \
stats.o
-ifdef CONFIG_NFSD_V3
- O_OBJS += nfs3proc.o nfs3xdr.o
-endif
-M_OBJS := $(O_TARGET)
+obj-$(CONFIG_NFSD_V3) += nfs3proc.o nfs3xdr.o
+
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 4cf7c897c..3c14a44c4 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -36,14 +36,6 @@ static u32 nfs3_ftypes[] = {
* XDR functions for basic NFS types
*/
static inline u32 *
-dec64(u32 *p, u64 *valp)
-{
- *valp = ((u64) ntohl(*p++)) << 32;
- *valp |= ntohl(*p++);
- return p;
-}
-
-static inline u32 *
encode_time3(u32 *p, time_t secs)
{
*p++ = htonl((u32) secs); *p++ = 0;
@@ -142,7 +134,7 @@ decode_sattr3(u32 *p, struct iattr *iap)
u64 newsize;
iap->ia_valid |= ATTR_SIZE;
- p = dec64(p, &newsize);
+ p = xdr_decode_hyper(p, &newsize);
if (newsize <= NFS_OFFSET_MAX)
iap->ia_size = newsize;
else
@@ -343,7 +335,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readargs *args)
{
if (!(p = decode_fh(p, &args->fh))
- || !(p = dec64(p, &args->offset)))
+ || !(p = xdr_decode_hyper(p, &args->offset)))
return 0;
args->count = ntohl(*p++);
@@ -355,7 +347,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_writeargs *args)
{
if (!(p = decode_fh(p, &args->fh))
- || !(p = dec64(p, &args->offset)))
+ || !(p = xdr_decode_hyper(p, &args->offset)))
return 0;
args->count = ntohl(*p++);
@@ -471,7 +463,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->cookie);
+ p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ~0;
args->count = ntohl(*p++);
@@ -485,7 +477,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->cookie);
+ p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ntohl(*p++);
args->count = ntohl(*p++);
@@ -499,7 +491,7 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p,
{
if (!(p = decode_fh(p, &args->fh)))
return 0;
- p = dec64(p, &args->offset);
+ p = xdr_decode_hyper(p, &args->offset);
args->count = ntohl(*p++);
return xdr_argsize_check(rqstp, p);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index b57b85ca1..bd01b57f5 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -359,8 +359,16 @@ static struct accessmap nfs3_diraccess[] = {
};
static struct accessmap nfs3_anyaccess[] = {
- /* XXX: should we try to cover read/write here for clients that
- * rely on us to do their access checking for special files? */
+ /* Some clients - Solaris 2.6 at least, make an access call
+ * to the server to check for access for things like /dev/null
+ * (which really, the server doesn't care about). So
+ * We provide simple access checking for them, looking
+ * mainly at mode bits
+ */
+ { NFS3_ACCESS_READ, MAY_READ },
+ { NFS3_ACCESS_EXECUTE, MAY_EXEC },
+ { NFS3_ACCESS_MODIFY, MAY_WRITE },
+ { NFS3_ACCESS_EXTEND, MAY_WRITE },
{ 0, 0 }
};
@@ -1501,12 +1509,17 @@ nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
inode->i_uid, inode->i_gid, current->fsuid, current->fsgid);
#endif
- if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
- if (EX_RDONLY(exp) || IS_RDONLY(inode))
- return nfserr_rofs;
- if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
- return nfserr_perm;
- }
+ /* only care about readonly exports for files and
+ * directories. links don't have meaningful write access,
+ * and all else is local to the client
+ */
+ if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))
+ if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
+ if (EX_RDONLY(exp) || IS_RDONLY(inode))
+ return nfserr_rofs;
+ if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
+ return nfserr_perm;
+ }
if ((acc & MAY_TRUNC) && IS_APPEND(inode))
return nfserr_perm;
diff --git a/fs/nls/Config.in b/fs/nls/Config.in
index 5c9754aca..8baecf971 100644
--- a/fs/nls/Config.in
+++ b/fs/nls/Config.in
@@ -2,10 +2,17 @@
# Native language support configuration
#
+# smb wants NLS
+if [ "$CONFIG_SMB_FS" = "m" -o "$CONFIG_SMB_FS" = "y" ]; then
+ define_bool CONFIG_SMB_NLS y
+else
+ define_bool CONFIG_SMB_NLS n
+fi
+
# msdos and Joliet want NLS
if [ "$CONFIG_JOLIET" = "y" -o "$CONFIG_FAT_FS" != "n" \
-o "$CONFIG_NTFS_FS" != "n" -o "$CONFIG_NCPFS_NLS" = "y" \
- -o "$CONFIG_SMB_FS" != "n" ]; then
+ -o "$CONFIG_SMB_NLS" = "y" ]; then
define_bool CONFIG_NLS y
else
define_bool CONFIG_NLS n
diff --git a/fs/nls/Makefile b/fs/nls/Makefile
index 893d3e1e9..194a3df8c 100644
--- a/fs/nls/Makefile
+++ b/fs/nls/Makefile
@@ -52,8 +52,7 @@ obj-$(CONFIG_NLS_KOI8_R) += nls_koi8-r.o
obj-$(CONFIG_NLS_ABC) += nls_abc.o
obj-$(CONFIG_NLS_UTF8) += nls_utf8.o
-OX_OBJS = $(obj-y)
-M_OBJS = $(obj-m)
+export-objs = $(obj-y)
O_TARGET = nls.o
diff --git a/fs/ntfs/Makefile b/fs/ntfs/Makefile
index 9e7ab2eaf..66c1b17a4 100644
--- a/fs/ntfs/Makefile
+++ b/fs/ntfs/Makefile
@@ -1,8 +1,9 @@
# Rules for making the NTFS driver
O_TARGET := ntfs.o
-O_OBJS := fs.o sysctl.o support.o util.o inode.o dir.o super.o attr.o
-M_OBJS := $(O_TARGET)
+
+obj-y := fs.o sysctl.o support.o util.o inode.o dir.o super.o attr.o
+obj-m := $(O_TARGET)
EXTRA_CFLAGS = -DNTFS_IN_LINUX_KERNEL -DNTFS_VERSION=\"000607\"
include $(TOPDIR)/Rules.make
diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c
index ad99eb13b..f54a7eb57 100644
--- a/fs/ntfs/fs.c
+++ b/fs/ntfs/fs.c
@@ -601,7 +601,7 @@ static int ntfs_readpage(struct file *file, struct page *page)
static int ntfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,ntfs_get_block,
- &((struct inode*)page->mapping->host)->u.ntfs_i.mmu_private);
+ &page->mapping->host->u.ntfs_i.mmu_private);
}
static int _ntfs_bmap(struct address_space *mapping, long block)
{
@@ -963,8 +963,10 @@ static void __exit exit_ntfs_fs(void)
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Martin von Löwis");
MODULE_DESCRIPTION("NTFS driver");
+#ifdef DEBUG
MODULE_PARM(ntdebug, "i");
MODULE_PARM_DESC(ntdebug, "Debug level");
+#endif
module_init(init_ntfs_fs)
module_exit(exit_ntfs_fs)
diff --git a/fs/openpromfs/Makefile b/fs/openpromfs/Makefile
index a97a5615d..f9d8cd339 100644
--- a/fs/openpromfs/Makefile
+++ b/fs/openpromfs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := openpromfs.o
-O_OBJS := inode.o
-M_OBJS := $(O_TARGET)
+
+obj-y := inode.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile
index ed64f7c56..e082843c1 100644
--- a/fs/partitions/Makefile
+++ b/fs/partitions/Makefile
@@ -8,7 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := partitions.o
-OX_OBJS := check.o
+
+export-objs := check.o
+
+obj-y := check.o
obj-$(CONFIG_ACORN_PARTITION) += acorn.o
obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
@@ -21,8 +24,5 @@ obj-$(CONFIG_SUN_PARTITION) += sun.o
obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o
obj-$(CONFIG_IBM_PARTITION) += ibm.o
-O_OBJS += $(obj-y)
-M_OBJS += $(obj-m)
-
include $(TOPDIR)/Rules.make
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 87b88d04a..53b05e3ef 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -123,8 +123,8 @@ char *disk_name (struct gendisk *hd, int minor, char *buf)
maj = "hd";
break;
case MD_MAJOR:
- unit -= 'a'-'0';
- break;
+ sprintf(buf, "%s%d", maj, unit - 'a');
+ return buf;
}
if (hd->major >= SCSI_DISK1_MAJOR && hd->major <= SCSI_DISK7_MAJOR) {
unit = unit + (hd->major - SCSI_DISK1_MAJOR + 1) * 16;
@@ -408,7 +408,7 @@ void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors,
{
if (!gdev)
return;
- grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size);
+ grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size);
}
void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size)
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index ad890255e..de98f494e 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -8,13 +8,14 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := proc.o
-O_OBJS := inode.o root.o base.o generic.o array.o \
- kmsg.o proc_tty.o proc_misc.o kcore.o
-OX_OBJS := procfs_syms.o
-M_OBJS :=
+
+export-objs := procfs_syms.o
+
+obj-y := inode.o root.o base.o generic.o array.o \
+ kmsg.o proc_tty.o proc_misc.o kcore.o procfs_syms.o
ifeq ($(CONFIG_PROC_DEVICETREE),y)
-O_OBJS += proc_devtree.o
+obj-y += proc_devtree.o
endif
include $(TOPDIR)/Rules.make
diff --git a/fs/qnx4/Makefile b/fs/qnx4/Makefile
index 943eb1223..a3a3c5a7d 100644
--- a/fs/qnx4/Makefile
+++ b/fs/qnx4/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := qnx4.o
-O_OBJS := inode.o dir.o namei.o file.o bitmap.o truncate.o fsync.o
-M_OBJS := $(O_TARGET)
+
+obj-y := inode.o dir.o namei.o file.o bitmap.o truncate.o fsync.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 45a945209..c40f488e5 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -426,7 +426,7 @@ static int qnx4_readpage(struct file *file, struct page *page)
static int qnx4_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return cont_prepare_write(page,from,to,qnx4_get_block,
- &((struct inode*)page->mapping->host)->u.qnx4_i.mmu_private);
+ &page->mapping->host->u.qnx4_i.mmu_private);
}
static int qnx4_bmap(struct address_space *mapping, long block)
{
diff --git a/fs/ramfs/Makefile b/fs/ramfs/Makefile
index f57d5966c..44ff24f06 100644
--- a/fs/ramfs/Makefile
+++ b/fs/ramfs/Makefile
@@ -4,8 +4,7 @@
O_TARGET := ramfs.o
-O_OBJS := inode.o
-
-M_OBJS := $(O_TARGET)
+obj-y := inode.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 36fa933a4..898ab8178 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -98,7 +98,7 @@ static int ramfs_prepare_write(struct file *file, struct page *page, unsigned of
static int ramfs_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
kunmap(page);
@@ -269,6 +269,11 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
return error;
}
+static int ramfs_sync_file(struct file * file, struct dentry *dentry, int datasync)
+{
+ return 0;
+}
+
static struct address_space_operations ramfs_aops = {
readpage: ramfs_readpage,
writepage: ramfs_writepage,
@@ -279,12 +284,14 @@ static struct address_space_operations ramfs_aops = {
static struct file_operations ramfs_file_operations = {
read: generic_file_read,
write: generic_file_write,
- mmap: generic_file_mmap
+ mmap: generic_file_mmap,
+ fsync: ramfs_sync_file,
};
static struct file_operations ramfs_dir_operations = {
read: generic_read_dir,
readdir: dcache_readdir,
+ fsync: ramfs_sync_file,
};
static struct inode_operations ramfs_dir_inode_operations = {
diff --git a/fs/romfs/Makefile b/fs/romfs/Makefile
index 80579f8b8..65a88e40b 100644
--- a/fs/romfs/Makefile
+++ b/fs/romfs/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := romfs.o
-O_OBJS := inode.o
-M_OBJS := $(O_TARGET)
+
+obj-y := inode.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 081209a48..76c811852 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -395,7 +395,7 @@ out: return ERR_PTR(res);
static int
romfs_readpage(struct file *file, struct page * page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
unsigned long offset, avail, readlen;
void *buf;
int result = -EIO;
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile
index 825b0156a..db76849be 100644
--- a/fs/smbfs/Makefile
+++ b/fs/smbfs/Makefile
@@ -8,8 +8,9 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := smbfs.o
-O_OBJS := proc.o dir.o cache.o sock.o inode.o file.o ioctl.o getopt.o
-M_OBJS := $(O_TARGET)
+
+obj-y := proc.o dir.o cache.o sock.o inode.o file.o ioctl.o getopt.o
+obj-m := $(O_TARGET)
# If you want debugging output, you may add these flags to the EXTRA_CFLAGS
# SMBFS_PARANOIA should normally be enabled.
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index 79627f880..0a95735fd 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -161,7 +161,7 @@ smb_writepage(struct page *page)
if (!mapping)
BUG();
- inode = (struct inode *)mapping->host;
+ inode = mapping->host;
if (!inode)
BUG();
diff --git a/fs/sysv/Makefile b/fs/sysv/Makefile
index 394af0b4d..9eed30c9c 100644
--- a/fs/sysv/Makefile
+++ b/fs/sysv/Makefile
@@ -8,7 +8,8 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := sysv.o
-O_OBJS := ialloc.o balloc.o inode.o file.o dir.o namei.o fsync.o truncate.o
-M_OBJS := $(O_TARGET)
+
+obj-y := ialloc.o balloc.o inode.o file.o dir.o namei.o fsync.o truncate.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/udf/Makefile b/fs/udf/Makefile
index b1fcbed1f..97122f8f5 100644
--- a/fs/udf/Makefile
+++ b/fs/udf/Makefile
@@ -8,9 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile..
O_TARGET := udf.o
-O_OBJS := balloc.o dir.o file.o ialloc.o inode.o lowlevel.o namei.o \
+
+obj-y := balloc.o dir.o file.o ialloc.o inode.o lowlevel.o namei.o \
partition.o super.o truncate.o symlink.o fsync.o \
crc.o directory.o misc.o udftime.o unicode.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 3895d769b..9ab57d370 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -45,7 +45,7 @@
static int udf_adinicb_readpage(struct file *file, struct page * page)
{
- struct inode *inode = (struct inode *)page->mapping->host;
+ struct inode *inode = page->mapping->host;
struct buffer_head *bh;
int block;
@@ -69,7 +69,7 @@ static int udf_adinicb_readpage(struct file *file, struct page * page)
static int udf_adinicb_writepage(struct page *page)
{
- struct inode *inode = (struct inode *)page->mapping->host;
+ struct inode *inode = page->mapping->host;
struct buffer_head *bh;
int block;
@@ -97,7 +97,7 @@ static int udf_adinicb_prepare_write(struct file *file, struct page *page, unsig
static int udf_adinicb_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
- struct inode *inode = (struct inode *)page->mapping->host;
+ struct inode *inode = page->mapping->host;
struct buffer_head *bh;
int block;
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 547fc784b..be4e80165 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -79,7 +79,7 @@ static void udf_pc_to_char(char *from, int fromlen, char *to)
static int udf_symlink_filler(struct file *file, struct page *page)
{
- struct inode *inode = (struct inode*)page->mapping->host;
+ struct inode *inode = page->mapping->host;
struct buffer_head *bh = NULL;
char *symlink;
int err = -EIO;
diff --git a/fs/ufs/Makefile b/fs/ufs/Makefile
index 39d0d39ef..4e74b2459 100644
--- a/fs/ufs/Makefile
+++ b/fs/ufs/Makefile
@@ -8,8 +8,9 @@
# Note 2! The CFLAGS definitions are now in the main makefile.
O_TARGET := ufs.o
-O_OBJS := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \
+
+obj-y := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \
namei.o super.o symlink.o truncate.o util.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/umsdos/Makefile b/fs/umsdos/Makefile
index c14c1b615..a894146ba 100644
--- a/fs/umsdos/Makefile
+++ b/fs/umsdos/Makefile
@@ -8,9 +8,9 @@
# Note 2: the CFLAGS definitions are now in the main makefile.
O_TARGET := umsdos.o
-O_OBJS := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o
+obj-y := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o
-M_OBJS := $(O_TARGET)
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/vfat/Makefile b/fs/vfat/Makefile
index df903636f..55e0ea915 100644
--- a/fs/vfat/Makefile
+++ b/fs/vfat/Makefile
@@ -8,8 +8,10 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := vfat.o
-O_OBJS := namei.o
-OX_OBJS := vfatfs_syms.o
-M_OBJS := $(O_TARGET)
+
+export-objs := vfatfs_syms.o
+
+obj-y := namei.o vfatfs_syms.o
+obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index 1f4829709..35c6529be 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -442,10 +442,9 @@ static int vfat_valid_shortname(struct nls_table *nls, wchar_t *name, int len)
space = 1; /* disallow names starting with a dot */
for (walk = name; len && walk-name < 8;) {
len--;
- if ( (chl = nls->uni2char(*walk, charbuf, NLS_MAX_CHARSET_SIZE)) < 0) {
- walk++;
+ chl = nls->uni2char(*walk++, charbuf, NLS_MAX_CHARSET_SIZE);
+ if (chl < 0)
return -EINVAL;
- }
for (chi = 0; chi < chl; chi++) {
c = vfat_getupper(nls, charbuf[chi]);
@@ -471,7 +470,7 @@ dot:;
if (len >= 4) return -EINVAL;
while (len > 0) {
len--;
- chl = vfat_uni2short(nls, *walk++, charbuf, NLS_MAX_CHARSET_SIZE);
+ chl = nls->uni2char(*walk++, charbuf, NLS_MAX_CHARSET_SIZE);
if (chl < 0)
return -EINVAL;
for (chi = 0; chi < chl; chi++) {