Skip to content

Commit 11fbf53

Browse files
committed
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "Assorted bits and pieces from various people. No common topic in this pile, sorry" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs/affs: add rename exchange fs/affs: add rename2 to prepare multiple methods Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx() fs: don't set *REFERENCED on single use objects fs: compat: Remove warning from COMPATIBLE_IOCTL remove pointless extern of atime_need_update_rcu() fs: completely ignore unknown open flags fs: add a VALID_OPEN_FLAGS fs: remove _submit_bh() fs: constify tree_descr arrays passed to simple_fill_super() fs: drop duplicate header percpu-rwsem.h fs/affs: bugfix: Write files greater than page size on OFS fs/affs: bugfix: enable writes on OFS disks fs/affs: remove node generation check fs/affs: import amigaffs.h fs/affs: bugfix: make symbolic links work again
2 parents 339fbf6 + 6b46576 commit 11fbf53

28 files changed

Lines changed: 130 additions & 74 deletions

File tree

‎drivers/infiniband/hw/qib/qib_fs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
512512
unsigned long flags;
513513
int ret;
514514

515-
static struct tree_descr files[] = {
515+
static const struct tree_descr files[] = {
516516
[2] = {"driver_stats", &driver_ops[0], S_IRUGO},
517517
[3] = {"driver_stats_names", &driver_ops[1], S_IRUGO},
518518
{""},

‎drivers/xen/xenfs/super.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ static const struct file_operations capabilities_file_ops = {
4444

4545
static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
4646
{
47-
static struct tree_descr xenfs_files[] = {
47+
static const struct tree_descr xenfs_files[] = {
4848
[2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
4949
{ "capabilities", &capabilities_file_ops, S_IRUGO },
5050
{ "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
5151
{""},
5252
};
5353

54-
static struct tree_descr xenfs_init_files[] = {
54+
static const struct tree_descr xenfs_init_files[] = {
5555
[2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
5656
{ "capabilities", &capabilities_file_ops, S_IRUGO },
5757
{ "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },

‎fs/affs/affs.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <linux/types.h>
88
#include <linux/fs.h>
99
#include <linux/buffer_head.h>
10-
#include <linux/amigaffs.h>
10+
#include "amigaffs.h"
1111
#include <linux/mutex.h>
1212
#include <linux/workqueue.h>
1313

@@ -173,7 +173,7 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
173173
struct dentry *dentry);
174174
extern int affs_symlink(struct inode *dir, struct dentry *dentry,
175175
const char *symname);
176-
extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
176+
extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
177177
struct inode *new_dir, struct dentry *new_dentry,
178178
unsigned int flags);
179179

‎fs/affs/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = {
3535
.symlink = affs_symlink,
3636
.mkdir = affs_mkdir,
3737
.rmdir = affs_rmdir,
38-
.rename = affs_rename,
38+
.rename = affs_rename2,
3939
.setattr = affs_notify_change,
4040
};
4141

‎fs/affs/file.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ affs_getemptyblk_ino(struct inode *inode, int block)
499499
}
500500

501501
static int
502-
affs_do_readpage_ofs(struct page *page, unsigned to)
502+
affs_do_readpage_ofs(struct page *page, unsigned to, int create)
503503
{
504504
struct inode *inode = page->mapping->host;
505505
struct super_block *sb = inode->i_sb;
@@ -518,7 +518,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
518518
boff = tmp % bsize;
519519

520520
while (pos < to) {
521-
bh = affs_bread_ino(inode, bidx, 0);
521+
bh = affs_bread_ino(inode, bidx, create);
522522
if (IS_ERR(bh))
523523
return PTR_ERR(bh);
524524
tmp = min(bsize - boff, to - pos);
@@ -620,7 +620,7 @@ affs_readpage_ofs(struct file *file, struct page *page)
620620
memset(page_address(page) + to, 0, PAGE_SIZE - to);
621621
}
622622

623-
err = affs_do_readpage_ofs(page, to);
623+
err = affs_do_readpage_ofs(page, to, 0);
624624
if (!err)
625625
SetPageUptodate(page);
626626
unlock_page(page);
@@ -657,7 +657,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
657657
return 0;
658658

659659
/* XXX: inefficient but safe in the face of short writes */
660-
err = affs_do_readpage_ofs(page, PAGE_SIZE);
660+
err = affs_do_readpage_ofs(page, PAGE_SIZE, 1);
661661
if (err) {
662662
unlock_page(page);
663663
put_page(page);
@@ -679,7 +679,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
679679
int written;
680680

681681
from = pos & (PAGE_SIZE - 1);
682-
to = pos + len;
682+
to = from + len;
683683
/*
684684
* XXX: not sure if this can handle short copies (len < copied), but
685685
* we don't have to, because the page should always be uptodate here,

‎fs/affs/inode.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
140140
inode->i_fop = &affs_file_operations;
141141
break;
142142
case ST_SOFTLINK:
143+
inode->i_size = strlen((char *)AFFS_HEAD(bh)->table);
143144
inode->i_mode |= S_IFLNK;
144145
inode_nohighmem(inode);
145146
inode->i_op = &affs_symlink_inode_operations;

‎fs/affs/namei.c‎

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
365365
symname++;
366366
}
367367
*p = 0;
368+
inode->i_size = i + 1;
368369
mark_buffer_dirty_inode(bh, inode);
369370
affs_brelse(bh);
370371
mark_inode_dirty(inode);
@@ -393,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
393394
return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
394395
}
395396

396-
int
397+
static int
397398
affs_rename(struct inode *old_dir, struct dentry *old_dentry,
398-
struct inode *new_dir, struct dentry *new_dentry,
399-
unsigned int flags)
399+
struct inode *new_dir, struct dentry *new_dentry)
400400
{
401401
struct super_block *sb = old_dir->i_sb;
402402
struct buffer_head *bh = NULL;
403403
int retval;
404404

405-
if (flags & ~RENAME_NOREPLACE)
406-
return -EINVAL;
407-
408-
pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
409-
old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
410-
411405
retval = affs_check_name(new_dentry->d_name.name,
412406
new_dentry->d_name.len,
413407
affs_nofilenametruncate(old_dentry));
@@ -447,6 +441,76 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
447441
return retval;
448442
}
449443

444+
static int
445+
affs_xrename(struct inode *old_dir, struct dentry *old_dentry,
446+
struct inode *new_dir, struct dentry *new_dentry)
447+
{
448+
449+
struct super_block *sb = old_dir->i_sb;
450+
struct buffer_head *bh_old = NULL;
451+
struct buffer_head *bh_new = NULL;
452+
int retval;
453+
454+
bh_old = affs_bread(sb, d_inode(old_dentry)->i_ino);
455+
if (!bh_old)
456+
return -EIO;
457+
458+
bh_new = affs_bread(sb, d_inode(new_dentry)->i_ino);
459+
if (!bh_new)
460+
return -EIO;
461+
462+
/* Remove old header from its parent directory. */
463+
affs_lock_dir(old_dir);
464+
retval = affs_remove_hash(old_dir, bh_old);
465+
affs_unlock_dir(old_dir);
466+
if (retval)
467+
goto done;
468+
469+
/* Remove new header from its parent directory. */
470+
affs_lock_dir(new_dir);
471+
retval = affs_remove_hash(new_dir, bh_new);
472+
affs_unlock_dir(new_dir);
473+
if (retval)
474+
goto done;
475+
476+
/* Insert old into the new directory with the new name. */
477+
affs_copy_name(AFFS_TAIL(sb, bh_old)->name, new_dentry);
478+
affs_fix_checksum(sb, bh_old);
479+
affs_lock_dir(new_dir);
480+
retval = affs_insert_hash(new_dir, bh_old);
481+
affs_unlock_dir(new_dir);
482+
483+
/* Insert new into the old directory with the old name. */
484+
affs_copy_name(AFFS_TAIL(sb, bh_new)->name, old_dentry);
485+
affs_fix_checksum(sb, bh_new);
486+
affs_lock_dir(old_dir);
487+
retval = affs_insert_hash(old_dir, bh_new);
488+
affs_unlock_dir(old_dir);
489+
done:
490+
mark_buffer_dirty_inode(bh_old, new_dir);
491+
mark_buffer_dirty_inode(bh_new, old_dir);
492+
affs_brelse(bh_old);
493+
affs_brelse(bh_new);
494+
return retval;
495+
}
496+
497+
int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
498+
struct inode *new_dir, struct dentry *new_dentry,
499+
unsigned int flags)
500+
{
501+
502+
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
503+
return -EINVAL;
504+
505+
pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
506+
old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
507+
508+
if (flags & RENAME_EXCHANGE)
509+
return affs_xrename(old_dir, old_dentry, new_dir, new_dentry);
510+
511+
return affs_rename(old_dir, old_dentry, new_dir, new_dentry);
512+
}
513+
450514
static struct dentry *affs_get_parent(struct dentry *child)
451515
{
452516
struct inode *parent;
@@ -477,11 +541,6 @@ static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino,
477541
if (IS_ERR(inode))
478542
return ERR_CAST(inode);
479543

480-
if (generation && inode->i_generation != generation) {
481-
iput(inode);
482-
return ERR_PTR(-ESTALE);
483-
}
484-
485544
return inode;
486545
}
487546

‎fs/binfmt_misc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static const struct super_operations s_ops = {
818818
static int bm_fill_super(struct super_block *sb, void *data, int silent)
819819
{
820820
int err;
821-
static struct tree_descr bm_files[] = {
821+
static const struct tree_descr bm_files[] = {
822822
[2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO},
823823
[3] = {"register", &bm_register_operations, S_IWUSR},
824824
/* last one */ {""}

‎fs/buffer.c‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
5151
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
52-
unsigned long bio_flags,
5352
struct writeback_control *wbc);
5453

5554
#define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
@@ -1830,7 +1829,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,
18301829
do {
18311830
struct buffer_head *next = bh->b_this_page;
18321831
if (buffer_async_write(bh)) {
1833-
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
1832+
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc);
18341833
nr_underway++;
18351834
}
18361835
bh = next;
@@ -1884,7 +1883,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,
18841883
struct buffer_head *next = bh->b_this_page;
18851884
if (buffer_async_write(bh)) {
18861885
clear_buffer_dirty(bh);
1887-
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
1886+
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc);
18881887
nr_underway++;
18891888
}
18901889
bh = next;
@@ -3092,7 +3091,7 @@ void guard_bio_eod(int op, struct bio *bio)
30923091
}
30933092

30943093
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
3095-
unsigned long bio_flags, struct writeback_control *wbc)
3094+
struct writeback_control *wbc)
30963095
{
30973096
struct bio *bio;
30983097

@@ -3127,7 +3126,6 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
31273126

31283127
bio->bi_end_io = end_bio_bh_io_sync;
31293128
bio->bi_private = bh;
3130-
bio->bi_flags |= bio_flags;
31313129

31323130
/* Take care of bh's that straddle the end of the device */
31333131
guard_bio_eod(op, bio);
@@ -3142,16 +3140,9 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
31423140
return 0;
31433141
}
31443142

3145-
int _submit_bh(int op, int op_flags, struct buffer_head *bh,
3146-
unsigned long bio_flags)
3143+
int submit_bh(int op, int op_flags, struct buffer_head *bh)
31473144
{
3148-
return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL);
3149-
}
3150-
EXPORT_SYMBOL_GPL(_submit_bh);
3151-
3152-
int submit_bh(int op, int op_flags, struct buffer_head *bh)
3153-
{
3154-
return submit_bh_wbc(op, op_flags, bh, 0, NULL);
3145+
return submit_bh_wbc(op, op_flags, bh, NULL);
31553146
}
31563147
EXPORT_SYMBOL(submit_bh);
31573148

0 commit comments

Comments
 (0)