aboutsummaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)AuthorFilesLines
2012-09-24GFS2: Fix case where reservation finished at end of rgrpSteven Whitehouse1-0/+7
One corner case which the original patch failed to take into account was when there is a reservation which ended such that the following block was one beyond the end of the rgrp in question. This extra test fixes that case. Signed-off-by: Steven Whitehouse <[email protected]> Reported-by: Bob Peterson <[email protected]> Tested-by: Bob Peterson <[email protected]>
2012-09-24GFS2: Use RB_CLEAR_NODE() rather than rb_init_node()Michel Lespinasse1-2/+2
gfs2 calls RB_EMPTY_NODE() to check if nodes are not on an rbtree. The corresponding initialization function is RB_CLEAR_NODE(). rb_init_node() was never clearly defined and is going away. Signed-off-by: Michel Lespinasse <[email protected]> Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Update rgblk_free() to use rbmSteven Whitehouse1-30/+14
Replace open coded version with a call to gfs2_rbm_from_block() Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Update gfs2_get_block_type() to use rbmSteven Whitehouse1-19/+6
Use the new gfs2_rbm_from_block() function to replace an open coded version of the same code. Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Replace rgblk_search with gfs2_rbm_findSteven Whitehouse2-210/+257
This is part of a series of patches which are introducing the gfs2_rbm structure throughout the block allocation code. The main aim of this part is to create a search function which can deal directly with struct gfs2_rbm. In this case it specifies the initial position at which to start the search and also the point at which the search terminates. The net result of this is to clean up the search code and make it rather more readable, and the various possible exceptions which may occur during the search are partitioned into their own functions. There are some bug fixes too. We should not be checking the reservations while allocating extents - the time for that is when we are searching for where to put the extent, not when we've already made that decision. Also, rgblk_search had two uses, and in only one of those cases did it make sense to check for reservations. This is fixed in the new gfs2_rbm_find function, which has a cleaner interface. The reservation checking has been improved by always checking for contiguous reservations, and returning the first free block after all contiguous reservations. This is done under the spin lock to ensure consistancy of the tree. The allocation of extents is now in all cases done by the existing allocation code, and if there is an active reservation, that is updated after the fact. Again this is done under the spin lock, since it entails changing the lookup key for the reservation in question. Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Add structure to contain rgrp, bitmap, offset tupleSteven Whitehouse6-115/+105
This patch introduces a new structure, gfs2_rbm, which is a tuple of a resource group, a bitmap within the resource group and an offset within that bitmap. This is designed to make manipulating these sets of variables easier. There is also a new helper function which converts this representation back to a disk block address. In addition, the rbtree nodes which are used for the reservations were not being correctly initialised, which is now fixed. Also, the tracing was not passing through the inode where it should have been. That is mostly fixed aside from one corner case. This needs to be revisited since there can also be a NULL rgrp in some cases which results in the device being incorrect in the trace. This is intended to be the first step towards cleaning up some of the allocation code, and some further bug fixes. Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Remove rs_requested field from reservationsSteven Whitehouse9-59/+27
The rs_requested field is left over from the original allocation code, however this should have been a parameter passed to the various functions from gfs2_inplace_reserve() and not a member of the reservation structure as the value is not required after the initial allocation. This also helps simplify the code since we no longer need to set the rs_requested to zero. Also the gfs2_inplace_release() function can also be simplified since the reservation structure will always be defined when it is called, and the only remaining task is to unlock the rgrp if required. It can also now be called unconditionally too, resulting in a further simplification. Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-24GFS2: Merge two nearly identical xattr functionsSteven Whitehouse1-64/+30
There were two functions in the xattr code which were nearly identical, the only difference being that one was copy data into the unstuffed xattrs and the other was copying data out from it. This patch merges the two functions such that the code which deal with iteration over the unstuffed xattrs is no longer duplicated. Signed-off-by: Steven Whitehouse <[email protected]>
2012-09-23ext4: check free inode count before allocating an inodeYongqiang Yang1-0/+9
Recently, I ecountered some corrupted filesystems in which some groups' free inode counts were 65535, it seemed that free inode count was overflow. This patch teaches ext4 to check free inode count before allocaing an inode. Signed-off-by: Yongqiang Yang <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2012-09-23ext4: check free block counters in ext4_mb_find_by_goalYongqiang Yang1-0/+3
Free block counters should be checked before doing allocation. Signed-off-by: Yongqiang Yang <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2012-09-23ext4: fix crash when accessing /proc/mounts concurrentlyHerton Ronaldo Krzesinski1-1/+1
The crash was caused by a variable being erronously declared static in token2str(). In addition to /proc/mounts, the problem can also be easily replicated by accessing /proc/fs/ext4/<partition>/options in parallel: $ cat /proc/fs/ext4/<partition>/options > options.txt ... and then running the following command in two different terminals: $ while diff /proc/fs/ext4/<partition>/options options.txt; do true; done This is also the cause of the following a crash while running xfstests #234, as reported in the following bug reports: https://bugs.launchpad.net/bugs/1053019 https://bugzilla.kernel.org/show_bug.cgi?id=47731 Signed-off-by: Herton Ronaldo Krzesinski <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: Brad Figg <[email protected]> Cc: [email protected]
2012-09-22close the race in nlmsvc_free_block()Al Viro1-2/+1
we need to grab mutex before the reference counter reaches 0 Signed-off-by: Al Viro <[email protected]>
2012-09-22do_add_mount()/umount -l racesAl Viro1-2/+8
normally we deal with lock_mount()/umount races by checking that mountpoint to be is still in our namespace after lock_mount() has been done. However, do_add_mount() skips that check when called with MNT_SHRINKABLE in flags (i.e. from finish_automount()). The reason is that ->mnt_ns may be a temporary namespace created exactly to contain automounts a-la NFS4 referral handling. It's not the namespace of the caller, though, so check_mnt() would fail here. We still need to check that ->mnt_ns is non-NULL in that case, though. Signed-off-by: Al Viro <[email protected]>
2012-09-22Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6Linus Torvalds1-1/+1
Pull cifs fix from Steve French. * 'for-linus' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix return value in cifsConvertToUTF16
2012-09-21Merge tag 'for-linus-v3.6-rc7' of git://oss.sgi.com/xfs/xfsLinus Torvalds3-18/+29
Pull xfs bugfixes from Ben Myers: - fix a regression related to xfs_sync_worker racing with unmount. - fix a race while discarding xfs buffers. * tag 'for-linus-v3.6-rc7' of git://oss.sgi.com/xfs/xfs: xfs: stop the sync worker before xfs_unmountfs xfs: fix race while discarding buffers [V4]
2012-09-21debugfs: fix u32_array race in format_array_allocLinus Torvalds1-34/+23
The format_array_alloc() function is fundamentally racy, in that it prints the array twice: once to figure out how much space to allocate for the buffer, and the second time to actually print out the data. If any of the array contents changes in between, the allocation size may be wrong, and the end result may be truncated in odd ways. Just don't do it. Allocate a maximum-sized array up-front, and just format the array contents once. The only user of the u32_array interfaces is the Xen spinlock statistics code, and it has 31 entries in the arrays, so the maximum size really isn't that big, and the end result is much simpler code without the bug. Signed-off-by: Linus Torvalds <[email protected]>
2012-09-21debugfs: fix race in u32_array_read and allocate array at openDavid Rientjes1-22/+11
u32_array_open() is racy when multiple threads read from a file with a seek position of zero, i.e. when two or more simultaneous reads are occurring after the non-seekable files are created. It is possible that file->private_data is double-freed because the threads races between kfree(file->private-data); and file->private_data = NULL; The fix is to only do format_array_alloc() when the file is opened and free it when it is closed. Note that because the file has always been non-seekable, you can't open it and read it multiple times anyway, so the data has always been generated just once. The difference is that now it is generated at open time rather than at the time of the first read, and that avoids the race. Reported-by: Dave Jones <[email protected]> Acked-by: Konrad Rzeszutek Wilk <[email protected]> Tested-by: Raghavendra <[email protected]> Signed-off-by: David Rientjes <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-09-21compat_ioctl: Add RS-485 IOCTLs to the listJaeden Amero1-0/+2
The RS-485 TIOCSRS485 and TIOCGRS485 ioctls are 32-bit compatible, so in order to call them on 64-bit systems from 32-bit user mode, we add them to the ioctl pointer list as compatible ioctls. Signed-off-by: Jaeden Amero <[email protected]> Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-21userns: Convert the ufs filesystem to use kuid/kgid where appropriateEric W. Biederman1-8/+8
Cc: Evgeniy Dushistov <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert the udf filesystem to use kuid/kgid where appropriateEric W. Biederman3-16/+20
Cc: Jan Kara <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert ubifs to use kuid/kgidEric W. Biederman6-12/+12
Cc: Artem Bityutskiy <[email protected]> Cc: Adrian Hunter <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert squashfs to use kuid/kgid where appropriateEric W. Biederman1-2/+6
Cc: Phillip Lougher <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert reiserfs to use kuid and kgid where appropriateEric W. Biederman2-16/+30
Cc: [email protected] Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert jfs to use kuid/kgid where appropriateEric W. Biederman4-23/+33
Cc: Dave Kleikamp <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert jffs2 to use kuid and kgid where appropriateEric W. Biederman4-23/+39
- General routine uid/gid conversion work - When storing posix acls treat ACL_USER and ACL_GROUP separately so I can call from_kuid or from_kgid as appropriate. - When reading posix acls treat ACL_USER and ACL_GROUP separately so I can call make_kuid or make_kgid as appropriate. Cc: David Woodhouse <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert hpfs to use kuid and kgid where appropriateEric W. Biederman4-21/+28
Cc: Mikulas Patocka <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert btrfs to use kuid/kgid where appropriateEric W. Biederman3-11/+11
Cc: Chris Mason <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert bfs to use kuid/kgid where appropriateEric W. Biederman1-4/+4
Cc: "Tigran A. Aivazian" <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert affs to use kuid/kgid wherwe appropriateEric W. Biederman3-19/+23
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Teach security_path_chown to take kuids and kgidsEric W. Biederman1-1/+1
Don't make the security modules deal with raw user space uid and gids instead pass in a kuid_t and a kgid_t so that security modules only have to deal with internal kernel uids and gids. Cc: Al Viro <[email protected]> Cc: James Morris <[email protected]> Cc: John Johansen <[email protected]> Cc: Kentaro Takeda <[email protected]> Cc: Tetsuo Handa <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert hostfs to use kuid and kgid where appropriateEric W. Biederman1-4/+4
Cc: Jeff Dike <[email protected]> Cc: Richard Weinberger <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert freevxfs to use kuid/kgid where appropriateEric W. Biederman1-2/+2
Cc: Christoph Hellwig <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert the sysv filesystem to use kuid/kgid where appropriateEric W. Biederman1-4/+4
Cc: Christoph Hellwig <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert the qnx6 filesystem to use kuid/kgid where appropriateEric W. Biederman1-2/+2
Cc: Kai Bankett <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert the qnx4 filesystem to use kuid/kgid where appropriateEric W. Biederman1-2/+2
Acked-by: Anders Larsen <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert omfs to use kuid and kgid where appropriateEric W. Biederman2-4/+8
Acked-by: Bob Copeland <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert ntfs to use kuid and kgid where appropriateEric W. Biederman3-12/+39
Cc: Anton Altaparmakov <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert nillfs2 to use kuid/kgid where appropriateEric W. Biederman1-4/+4
Acked-by: Ryusuke Konishi <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert minix to use kuid/kgid where appropriateEric W. Biederman1-8/+8
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert logfs to use kuid/kgid where appropriateEric W. Biederman2-6/+6
Cc: Joern Engel <[email protected]> Cc: Prasad Joshi <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert isofs to use kuid/kgid where appropriateEric W. Biederman3-10/+15
Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert hfsplus to use kuid and kgid where appropriateEric W. Biederman4-11/+20
Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert hfs to use kuid and kgid where appropriateEric W. Biederman3-7/+17
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert exofs to use kuid/kgid where appropriateEric W. Biederman1-4/+4
Cc: Benny Halevy <[email protected]> Acked-by: Boaz Harrosh <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert efs to use kuid/kgid where appropriateEric W. Biederman1-2/+2
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert ecryptfs to use kuid/kgid where appropriateEric W. Biederman2-5/+5
Cc: Tyler Hicks <[email protected]> Cc: Dustin Kirkland <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert cramfs to use kuid/kgid where appropriateEric W. Biederman1-2/+2
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert befs to use kuid/kgid where appropriateEric W. Biederman2-10/+21
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert adfs to use kuid and kgid where appropriateEric W. Biederman3-12/+17
Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
2012-09-21userns: Convert hugetlbfs to use kuid/kgid where appropriateEric W. Biederman1-5/+11
Note sysctl_hugetlb_shm_group can only be written in the root user in the initial user namespace, so we can assume sysctl_hugetlb_shm_group is in the initial user namespace. Cc: William Irwin <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>