aboutsummaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)AuthorFilesLines
2012-09-26ext4: clean up online defrag bugs in move_extent_per_page()Dmitry Monakhov1-75/+178
Non-full list of bugs: 1) uninitialized extent optimization does not hold page's lock, and simply replace brunches after that writeback code goes crazy because block mapping changed under it's feets kernel BUG at fs/ext4/inode.c:1434! ( 288'th xfstress) 2) uninitialized extent may became initialized right after we drop i_data_sem, so extent state must be rechecked 3) Locked pages goes uptodate via following sequence: ->readpage(page); lock_page(page); use_that_page(page) But after readpage() one may invalidate it because it is uptodate and unlocked (reclaimer does that) As result kernel bug at include/linux/buffer_head.c:133! 4) We call write_begin() with already opened stansaction which result in following deadlock: ->move_extent_per_page() ->ext4_journal_start()-> hold journal transaction ->write_begin() ->ext4_da_write_begin() ->ext4_nonda_switch() ->writeback_inodes_sb_if_idle() --> will wait for journal_stop() 5) try_to_release_page() may fail and it does fail if one of page's bh was pinned by journal 6) If we about to change page's mapping we MUST hold it's lock during entire remapping procedure, this is true for both pages(original and donor one) Fixes: - Avoid (1) and (2) simply by temproraly drop uninitialized extent handling optimization, this will be reimplemented later. - Fix (3) by manually forcing page to uptodate state w/o dropping it's lock - Fix (4) by rearranging existing locking: from: journal_start(); ->write_begin to: write_begin(); journal_extend() - Fix (5) simply by checking retvalue - Fix (6) by locking both (original and donor one) pages during extent swap with help of mext_page_double_lock() Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2012-09-26ext4: online defrag is not supported for journaled filesDmitry Monakhov1-1/+6
Proper block swap for inodes with full journaling enabled is truly non obvious task. In order to be on a safe side let's explicitly disable it for now. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
2012-09-26ext4: move_extent code cleanupDmitry Monakhov1-120/+47
- Remove usless checks, because it is too late to check that inode != NULL at the moment it was referenced several times. - Double lock routines looks very ugly and locking ordering relays on order of i_ino, but other kernel code rely on order of pointers. Let's make them simple and clean. - check that inodes belongs to the same SB as soon as possible. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
2012-09-26ext4: don't call update_backups() multiple times for the same bgTao Ma1-0/+4
When performing an online resize, we add a bunch of groups at one time in ext4_flex_group_add, so in most cases a lot of group descriptors will be in the same group block. But in the end of this function, update_backups will be called for every group descriptor and the same block will be copied and journalled again and again. It is really a waste. Fix things so we only update a particular bg descriptor block once and skip subsequent updates of the same block. Signed-off-by: Tao Ma <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2012-09-25ext4: fix double unlock buffer mess during fs-resizeDmitry Monakhov1-10/+5
bh_submit_read() is responsible for unlock bh on endio. In addition, we need to use bh_uptodate_or_lock() to avoid races. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2012-09-25compat_ioctl: Avoid using undefined RS-485 IOCTLsJaeden Amero1-0/+4
Wrap the use of TIOCSRS485 and TIOCGRS485 in #ifdef so that we avoid adding undefined IOCTLs to the ioctl pointer list as compatible ioctls. This change was motivated by a build error on a MIPS build. tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next head: ac57e7f38ea6fe7358cd0b7a2f2d21aef5ab70cd commit: 84c3b84860440a9e3a3666c14112f41311b8f623 [10/16] compat_ioctl: Add RS-485 IOCTLs to the list config: mips-fuloong2e_defconfig All related error/warning messages: fs/compat_ioctl.c:869:1: error: 'TIOCSRS485' undeclared here (not in a function) fs/compat_ioctl.c:870:1: error: 'TIOCGRS485' undeclared here (not in a function) vim +869 fs/compat_ioctl.c 863 COMPATIBLE_IOCTL(TIOCSPGRP) 864 COMPATIBLE_IOCTL(TIOCGPGRP) 865 COMPATIBLE_IOCTL(TIOCGPTN) 866 COMPATIBLE_IOCTL(TIOCSPTLCK) 867 COMPATIBLE_IOCTL(TIOCSERGETLSR) 868 COMPATIBLE_IOCTL(TIOCSIG) > 869 COMPATIBLE_IOCTL(TIOCSRS485) 870 COMPATIBLE_IOCTL(TIOCGRS485) 871 #ifdef TCGETS2 872 COMPATIBLE_IOCTL(TCGETS2) Reported-by: Fengguang Wu <[email protected]> Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Jaeden Amero <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-24cifs: remove support for deprecated "forcedirectio" and "strictcache" mount ↵Jeff Layton1-33/+4
options ...and make the default cache=strict as promised for 3.7. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: remove support for CIFS_IOC_CHECKUMOUNT ioctlJeff Layton1-19/+0
...as promised for 3.7. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Fix possible memory leaks in SMB2 codePavel Shilovsky1-9/+14
and add missed increments of failed async read and write requests. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Fix endian conversion of IndexNumberPavel Shilovsky1-1/+1
by making it __le64 rather than __u64 in FILE_AL_INFO structure. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24Trivial endian fixesSteve French2-3/+4
Some trivial endian fixes for the SMB2 code. One warning remains which I asked Pavel to look at. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24MARK SMB2 support EXPERIMENTALSteve French1-1/+1
Now that the merge of the remaining pieces needed for SMB2 (SMB2.1 dialect) are in, and most test cases pass, we can consider SMB2.1 EXPERIMENTAL rather than "BROKEN." Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24Update cifs version numberSteve French1-1/+1
With SMB2 support, update from version 1.79 to 2.0 to make it easier for users to recognize which version has SMB2 support. Signed-off-by: Steve French <[email protected]> Reviewed-by: Jeff Layton <[email protected]>
2012-09-24cifs: add FL_CLOSE to fl_flags mask in cifs_read_flockJeff Layton1-1/+2
FL_CLOSE is quite common when you close a file on which you hold a lock. The spurious "Unknown lock flags" message in cFYI is confusing in this case. Reported-by: Alexander Bokovoy <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: Mangle string used for unc in /proc/mountsSachin Prabhu1-1/+2
The string for "unc=" in /proc/mounts needs to be escaped. The current behaviour can create problems in cases when mounting a share starting with a number. example: >mount -t cifs -o username=test,password=x vm140-31:/17000-test /mnt >mount -o remount,password=x /mnt mount error: could not resolve address for vm140-31x00-test: Unknown error The sub-string "\170" which is part of the unc for the mount above in /proc/mounts is interpreted as character'x' in the case above. Escaping the string fixes the problem. Signed-off-by: Sachin Prabhu <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: cleanups for cifs_mkdir_qinfoJeff Layton1-27/+24
Rename inode pointers for better clarity. Move the d_instantiate call to the end of the function to prevent other tasks from seeing it before we've finished constructing it. Since we should have exclusive access to the inode at this point, remove the spinlock around i_nlink update. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Fix fast lease break after open problemPavel Shilovsky7-10/+158
Now we walk though cifsFileInfo's list for every incoming lease break and look for an equivalent there. That approach misses lease breaks that come just after an open response - we don't have time to populate new cifsFileInfo structure to the list. Fix this by adding new list of pending opens and look for a lease there if we didn't find it in the list of cifsFileInfo structures. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Add SMB2.1 lease break supportPavel Shilovsky6-14/+157
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Fix cache coherency for read oplock casePavel Shilovsky1-4/+23
When we have a file opened with read oplock and we are writing a data to this file, we need to store the data in the cache and then send to the server to ensure that the next read operation will get a coherent data. Also mark it as CONFIG_CIFS_SMB2 because it's more suitable for SMB2 code but can fix some CIFS problems too (when server delays sending an oplock break after a write request). We can drop this ifdefs dependence in future. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Request SMB2.1 leasesPavel Shilovsky8-27/+256
if server supports them and we need oplocks. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Check for mandatory brlocks on read/writePavel Shilovsky2-23/+102
Currently CIFS code accept read/write ops on mandatory locked area when two processes use the same file descriptor - it's wrong. Fix this by serializing io and brlock operations on the inode. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Turn lock mutex into rw semaphorePavel Shilovsky4-38/+41
and allow several processes to walk through the lock list and read can_cache_brlcks value if they are not going to modify them. Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Use brlock cache for SMB2Pavel Shilovsky3-1/+94
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Add brlock support for SMB2Pavel Shilovsky7-5/+210
Signed-off-by: Pavel Shilovsky <[email protected]>
2012-09-24CIFS: Handle SMB2 lock flagsPavel Shilovsky2-0/+17
Signed-off-by: Pavel Shilovsky <[email protected]>
2012-09-24CIFS: Move brlock code to ops structPavel Shilovsky4-25/+40
Signed-off-by: Pavel Shilovsky <[email protected]>
2012-09-24CIFS: Remove spinlock dependence in brlock processingPavel Shilovsky3-39/+53
Now we need to lock/unlock a spinlock while processing brlock ops on the inode. Move brlocks of a fid to a separate list and attach all such lists to the inode. This let us not hold a spinlock. Signed-off-by: Pavel Shilovsky <[email protected]>
2012-09-24CIFS: Add NTLMSSP sec type to defaultsPavel Shilovsky1-1/+1
to let us negotiate SMB2 without specifying sec type explicitly. Signed-off-by: Pavel Shilovsky <[email protected]>
2012-09-24cifs: remove kmap lock and rsize limitJeff Layton4-49/+0
Now that we aren't abusing the kmap address space, there's no need for this lock or to impose a limit on the rsize. Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: replace kvec array in readdata with a single kvecJeff Layton4-32/+21
The array is no longer needed. We just need a single kvec to hold the header for signature checking. Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: convert async read code to use pages array without kmappingJeff Layton4-81/+80
Replace the "marshal_iov" function with a "read_into_pages" function. That function will copy the read data off the socket and into the pages array, kmapping and reading pages one at a time. Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: turn the pages list in cifs_readdata into an arrayJeff Layton2-38/+52
We'll need an array to put into a smb_rqst, so convert this into an array instead of (ab)using the lru list_head. Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: allocate kvec array for cifs_readdata as a separate allocationJeff Layton2-4/+13
Eventually, we're going to want to append a list of pages to cifs_readdata instead of a list of kvecs. To prepare for that, turn the kvec array allocation into a separate one and just keep a pointer to it in the readdata. Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: add deprecation warning to sockopt=TCP_NODELAY optionJeff Layton1-5/+6
Now that we're using TCP_CORK on the socket, there's no value in continuting to support this option. Schedule it for removal in 3.9. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
2012-09-24cifs: remove the kmap size limit from wsizeJeff Layton2-6/+0
Now that we're not kmapping so much at once, there's no need to cap the wsize at the amount that can be simultaneously kmapped. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: convert async write code to pass in data via rq_pages arrayJeff Layton4-95/+33
Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: change cifs_call_async to use smb_rqst structsJeff Layton7-79/+85
For now, none of the callers populate rq_pages. That will be done for writes in a later patch. While we're at it, change the prototype of setup_async_request not to need a return pointer argument. Just return the pointer to the mid_q_entry or an ERR_PTR. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: teach signing routines how to deal with arrays of pages in a smb_rqstJeff Layton4-1/+25
Use the smb_send_rqst helper function to kmap each page in the array and update the hash for that chunk. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: teach smb_send_rqst how to handle arrays of pagesJeff Layton1-2/+54
Add code that allows smb_send_rqst to send an array of pages after the initial kvec array has been sent. For now, we simply kmap the page array and send it using the standard smb_send_kvec function. Eventually, we may want to convert this code to use kernel_sendpage under the hood and avoid the kmap altogether for the page data. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: cork the socket before a send and uncork it afterwardJeff Layton2-0/+16
We want to send SMBs as "atomically" as possible. Prior to sending any data on the socket, cork it to make sure that no non-full frames go out. Afterward, uncork it to make sure all of the data gets pushed out to the wire. Note that this more or less renders the socket=TCP_NODELAY mount option obsolete. When TCP_CORK and TCP_NODELAY are used on the same socket, TCP_NODELAY is essentially ignored. Acked-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: convert send code to use smb_rqst structsJeff Layton1-45/+90
Again, just a change in the arguments and some function renaming here. In later patches, we'll change this code to deal with page arrays. In this patch, we add a new smb_send_rqst wrapper and have smb_sendv call that. Then we move most of the existing smb_sendv code into a new function -- smb_send_kvec. This seems a little redundant, but later we'll flesh this out to deal with arrays of pages. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: change smb2 signing routines to use smb_rqst structsJeff Layton3-26/+27
Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24cifs: change signing routines to deal with smb_rqst structsJeff Layton5-14/+44
We need a way to represent a call to be sent on the wire that does not require having all of the page data kmapped. Behold the smb_rqst struct. This new struct represents an array of kvecs immediately followed by an array of pages. Convert the signing routines to use these structs under the hood and turn the existing functions for this into wrappers around that. For now, we're just changing these functions to take different args. Later, we'll teach them how to deal with arrays of pages. Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Add statfs support for SMB2Pavel Shilovsky5-0/+127
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Move statfs to ops structPavel Shilovsky3-25/+43
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Add oplock break support for SMB2Pavel Shilovsky5-2/+141
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Move oplock break to ops structPavel Shilovsky3-4/+17
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Process oplocks for SMB2Pavel Shilovsky7-12/+68
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Add readdir support for SMB2Pavel Shilovsky5-2/+264
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
2012-09-24CIFS: Move readdir code to ops structPavel Shilovsky6-103/+173
Signed-off-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>