Skip to content

Commit b8a7f3c

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: kill I_LOCK fold do_sync_file_range into sys_sync_file_range fix up O_SYNC comments VFS/fsstack: handle 32-bit smp + preempt + large files in fsstack_copy_inode_size fsstack/ecryptfs: remove unused get_nlinks param to fsstack_copy_attr_all vfs: remove extraneous NULL d_inode check from do_filp_open fs: no games with DCACHE_UNHASHED fs: anon_inodes implement dname dio: fix use-after-free
2 parents a377d18 + eaff807 commit b8a7f3c

24 files changed

Lines changed: 136 additions & 163 deletions

File tree

‎arch/alpha/include/asm/fcntl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define O_NOATIME 04000000
1717
#define O_CLOEXEC 010000000 /* set close_on_exec */
1818
/*
19-
* Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
19+
* Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
2020
* the O_SYNC flag. We continue to use the existing numerical value
2121
* for O_DSYNC semantics now, but using the correct symbolic name for it.
2222
* This new value is used to request true Posix O_SYNC semantics. It is

‎arch/mips/include/asm/fcntl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
2020
#define O_LARGEFILE 0x2000 /* allow large file opens */
2121
/*
22-
* Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
22+
* Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
2323
* the O_SYNC flag. We continue to use the existing numerical value
2424
* for O_DSYNC semantics now, but using the correct symbolic name for it.
2525
* This new value is used to request true Posix O_SYNC semantics. It is

‎arch/sparc/include/asm/fcntl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define O_NOATIME 0x200000
2020
#define O_CLOEXEC 0x400000
2121
/*
22-
* Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
22+
* Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
2323
* the O_SYNC flag. We continue to use the existing numerical value
2424
* for O_DSYNC semantics now, but using the correct symbolic name for it.
2525
* This new value is used to request true Posix O_SYNC semantics. It is

‎fs/anon_inodes.c‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags,
3535
mnt);
3636
}
3737

38-
static int anon_inodefs_delete_dentry(struct dentry *dentry)
38+
/*
39+
* anon_inodefs_dname() is called from d_path().
40+
*/
41+
static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
3942
{
40-
/*
41-
* We faked vfs to believe the dentry was hashed when we created it.
42-
* Now we restore the flag so that dput() will work correctly.
43-
*/
44-
dentry->d_flags |= DCACHE_UNHASHED;
45-
return 1;
43+
return dynamic_dname(dentry, buffer, buflen, "anon_inode:%s",
44+
dentry->d_name.name);
4645
}
4746

4847
static struct file_system_type anon_inode_fs_type = {
@@ -51,7 +50,7 @@ static struct file_system_type anon_inode_fs_type = {
5150
.kill_sb = kill_anon_super,
5251
};
5352
static const struct dentry_operations anon_inodefs_dentry_operations = {
54-
.d_delete = anon_inodefs_delete_dentry,
53+
.d_dname = anon_inodefs_dname,
5554
};
5655

5756
/*
@@ -119,8 +118,6 @@ struct file *anon_inode_getfile(const char *name,
119118
atomic_inc(&anon_inode_inode->i_count);
120119

121120
path.dentry->d_op = &anon_inodefs_dentry_operations;
122-
/* Do not publish this dentry inside the global dentry hash table */
123-
path.dentry->d_flags &= ~DCACHE_UNHASHED;
124121
d_instantiate(path.dentry, anon_inode_inode);
125122

126123
error = -ENFILE;

‎fs/direct-io.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
12061206
* NOTE: filesystems with their own locking have to handle this
12071207
* on their own.
12081208
*/
1209-
if (dio->flags & DIO_LOCKING) {
1209+
if (flags & DIO_LOCKING) {
12101210
if (unlikely((rw & WRITE) && retval < 0)) {
12111211
loff_t isize = i_size_read(inode);
12121212
if (end > isize)

‎fs/ecryptfs/dentry.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
6262
struct inode *lower_inode =
6363
ecryptfs_inode_to_lower(dentry->d_inode);
6464

65-
fsstack_copy_attr_all(dentry->d_inode, lower_inode, NULL);
65+
fsstack_copy_attr_all(dentry->d_inode, lower_inode);
6666
}
6767
out:
6868
return rc;

‎fs/ecryptfs/inode.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
626626
lower_new_dir_dentry->d_inode, lower_new_dentry);
627627
if (rc)
628628
goto out_lock;
629-
fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL);
629+
fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
630630
if (new_dir != old_dir)
631-
fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode, NULL);
631+
fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
632632
out_lock:
633633
unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
634634
dput(lower_new_dentry->d_parent);
@@ -967,7 +967,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
967967
rc = notify_change(lower_dentry, ia);
968968
mutex_unlock(&lower_dentry->d_inode->i_mutex);
969969
out:
970-
fsstack_copy_attr_all(inode, lower_inode, NULL);
970+
fsstack_copy_attr_all(inode, lower_inode);
971971
return rc;
972972
}
973973

‎fs/ecryptfs/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
189189
init_special_inode(inode, lower_inode->i_mode,
190190
lower_inode->i_rdev);
191191
dentry->d_op = &ecryptfs_dops;
192-
fsstack_copy_attr_all(inode, lower_inode, NULL);
192+
fsstack_copy_attr_all(inode, lower_inode);
193193
/* This size will be overwritten for real files w/ headers and
194194
* other metadata */
195195
fsstack_copy_inode_size(inode, lower_inode);

‎fs/gfs2/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static struct inode *gfs2_iget_skip(struct super_block *sb,
125125
* directory entry when gfs2_inode_lookup() is invoked. Part of the code
126126
* segment inside gfs2_inode_lookup code needs to get moved around.
127127
*
128-
* Clean up I_LOCK and I_NEW as well.
128+
* Clears I_NEW as well.
129129
**/
130130

131131
void gfs2_set_iop(struct inode *inode)

‎fs/inode.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void wake_up_inode(struct inode *inode)
113113
* Prevent speculative execution through spin_unlock(&inode_lock);
114114
*/
115115
smp_mb();
116-
wake_up_bit(&inode->i_state, __I_LOCK);
116+
wake_up_bit(&inode->i_state, __I_NEW);
117117
}
118118

119119
/**
@@ -690,17 +690,17 @@ void unlock_new_inode(struct inode *inode)
690690
}
691691
#endif
692692
/*
693-
* This is special! We do not need the spinlock when clearing I_LOCK,
693+
* This is special! We do not need the spinlock when clearing I_NEW,
694694
* because we're guaranteed that nobody else tries to do anything about
695695
* the state of the inode when it is locked, as we just created it (so
696-
* there can be no old holders that haven't tested I_LOCK).
696+
* there can be no old holders that haven't tested I_NEW).
697697
* However we must emit the memory barrier so that other CPUs reliably
698-
* see the clearing of I_LOCK after the other inode initialisation has
698+
* see the clearing of I_NEW after the other inode initialisation has
699699
* completed.
700700
*/
701701
smp_mb();
702-
WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
703-
inode->i_state &= ~(I_LOCK|I_NEW);
702+
WARN_ON(!(inode->i_state & I_NEW));
703+
inode->i_state &= ~I_NEW;
704704
wake_up_inode(inode);
705705
}
706706
EXPORT_SYMBOL(unlock_new_inode);
@@ -731,7 +731,7 @@ static struct inode *get_new_inode(struct super_block *sb,
731731
goto set_failed;
732732

733733
__inode_add_to_lists(sb, head, inode);
734-
inode->i_state = I_LOCK|I_NEW;
734+
inode->i_state = I_NEW;
735735
spin_unlock(&inode_lock);
736736

737737
/* Return the locked inode with I_NEW set, the
@@ -778,7 +778,7 @@ static struct inode *get_new_inode_fast(struct super_block *sb,
778778
if (!old) {
779779
inode->i_ino = ino;
780780
__inode_add_to_lists(sb, head, inode);
781-
inode->i_state = I_LOCK|I_NEW;
781+
inode->i_state = I_NEW;
782782
spin_unlock(&inode_lock);
783783

784784
/* Return the locked inode with I_NEW set, the
@@ -1083,7 +1083,7 @@ int insert_inode_locked(struct inode *inode)
10831083
ino_t ino = inode->i_ino;
10841084
struct hlist_head *head = inode_hashtable + hash(sb, ino);
10851085

1086-
inode->i_state |= I_LOCK|I_NEW;
1086+
inode->i_state |= I_NEW;
10871087
while (1) {
10881088
struct hlist_node *node;
10891089
struct inode *old = NULL;
@@ -1120,7 +1120,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
11201120
struct super_block *sb = inode->i_sb;
11211121
struct hlist_head *head = inode_hashtable + hash(sb, hashval);
11221122

1123-
inode->i_state |= I_LOCK|I_NEW;
1123+
inode->i_state |= I_NEW;
11241124

11251125
while (1) {
11261126
struct hlist_node *node;
@@ -1510,16 +1510,16 @@ EXPORT_SYMBOL(inode_wait);
15101510
* until the deletion _might_ have completed. Callers are responsible
15111511
* to recheck inode state.
15121512
*
1513-
* It doesn't matter if I_LOCK is not set initially, a call to
1513+
* It doesn't matter if I_NEW is not set initially, a call to
15141514
* wake_up_inode() after removing from the hash list will DTRT.
15151515
*
15161516
* This is called with inode_lock held.
15171517
*/
15181518
static void __wait_on_freeing_inode(struct inode *inode)
15191519
{
15201520
wait_queue_head_t *wq;
1521-
DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK);
1522-
wq = bit_waitqueue(&inode->i_state, __I_LOCK);
1521+
DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW);
1522+
wq = bit_waitqueue(&inode->i_state, __I_NEW);
15231523
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
15241524
spin_unlock(&inode_lock);
15251525
schedule();

0 commit comments

Comments
 (0)