Linux 2.6.27.24
Subsystems (19)
I'm announcing the release of the 2.6.27.24 kernel. All users of the 2.6.27 kernel series are very strongly encouraged to upgrade.
I'll also be replying to this message with a copy of the patch between 2.6.27.23 and 2.6.27.24
The updated 2.6.27.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.27.y.git
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.27.y.git;a=summarythanks,
greg k-h
------------
Documentation/filesystems/Locking | 26 ++- Makefile | 2 drivers/i2c/algos/i2c-algo-bit.c | 2 drivers/i2c/algos/i2c-algo-pca.c | 11 + drivers/md/bitmap.c | 29 ++-- drivers/md/md.c | 7 drivers/md/raid10.c | 12 - drivers/net/ehea/ehea_main.c | 31 ++-- drivers/serial/mpc52xx_uart.c | 2 drivers/usb/gadget/usbstring.c | 6 drivers/video/fb_defio.c | 3 fs/buffer.c | 20 ++ fs/cifs/cifs_unicode.h | 7 fs/cifs/cifssmb.c | 17 +- fs/cifs/connect.c | 6 fs/cifs/misc.c | 5 fs/cifs/readdir.c | 2 fs/cifs/sess.c | 44 +++--- fs/eventpoll.c | 2 fs/ext4/ext4.h | 2 fs/ext4/inode.c | 5 fs/fcntl.c | 6 fs/fuse/file.c | 3 fs/gfs2/ops_file.c | 7 fs/nfs/dir.c | 9 - fs/nfs/file.c | 9 - fs/nfsd/nfs4xdr.c | 16 ++ fs/ocfs2/file.c | 94 ++++++++++--- fs/ocfs2/mmap.c | 6 fs/splice.c | 274 +++++++++++++++++++++++--------------- fs/ubifs/file.c | 9 - fs/xfs/linux-2.6/xfs_file.c | 4 include/linux/buffer_head.h | 2 include/linux/mm.h | 3 include/linux/splice.h | 12 + mm/memory.c | 132 +++++++++++++----- 36 files changed, 546 insertions(+), 281 deletions(-)
Alan Stern (1):
USB: Gadget: fix UTF conversion in the usbstring library
Dave Airlie (1):
i2c-algo-bit: Fix timeout test
Davide Libenzi (1):
epoll: fix size check in epoll_create()
Enrik Berkhan (1):
i2c-algo-pca: Let PCA9564 recover from unacked data byte (state 0x30)
Grant Likely (1):
powerpc/5200: Don't specify IRQF_SHARED in PSC UART driver
Greg Kroah-Hartman (1):
Linux 2.6.27.24
Hannes Hering (1):
ehea: fix invalid pointer access
J. Bruce Fields (1):
nfsd4: check for negative dentry before use in nfsv4 readdir
Jeff Layton (2):
cifs: Fix buffer size for tcon->nativeFileSystem field
cifs: Fix unicode string area word alignment in session setup
Jeff Mahoney (1):
dup2: Fix return value with oldfd == newfd and invalid fd
Miklos Szeredi (4):
splice: split up __splice_from_pipe()
splice: remove i_mutex locking in splice_from_pipe()
splice: fix i_mutex locking in generic_splice_write()
ocfs2: fix i_mutex locking in ocfs2_splice_to_file()
NeilBrown (4):
md: fix loading of out-of-date bitmap.
md: fix some (more) errors with bitmaps on devices larger than 2TB. md/raid10: don't clear bitmap during recovery if array will still be degraded.
md: remove ability to explicit set an inactive array to 'clean'.
Nick Piggin (3):
mm: page_mkwrite change prototype to match fault
fs: fix page_mkwrite error cases in core code and btrfs
mm: close page_mkwrite races
Steven Whitehouse (1):
GFS2: Fix page_mkwrite() return code
Suresh Jayaraman (3):
cifs: Increase size of tmp_buf in cifs_readdir to avoid potential overflows
cifs: Fix incorrect destination buffer size in cifs_strncpy_to_host
cifs: Fix buffer size in cifs_convertUCSpath
Trond Myklebust (3):
NFS: Fix the return value in nfs_page_mkwrite()
NFS: Close page_mkwrite() races
NFS: Fix the notifications when renaming onto an existing file
Documentation/filesystems/Locking +17 -9
@@ -502,23 +502,31 @@ prototypes: void (*open)(struct vm_area_struct*); void (*close)(struct vm_area_struct*); int (*fault)(struct vm_area_struct*, struct vm_fault *); - int (*page_mkwrite)(struct vm_area_struct *, struct page *); + int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); locking rules: BKL mmap_sem PageLocked(page) open: no yes close: no yes -fault: no yes -page_mkwrite: no yes no +fault: no yes can return with page locked +page_mkwrite: no yes can return with page locked access: no yes - ->page_mkwrite() is called when a previously read-only page is -about to become writeable. The file system is responsible for -protecting against truncate races. Once appropriate action has been -taking to lock out truncate, the page range should be verified to be -within i_size. The page mapping should also be checked that it is not -NULL. + ->fault() is called when a previously not present pte is about +to be faulted in. The filesystem must find and return the page associated +with the passed in "pgoff" in the vm_fault structure. If it is possible that +the page may be truncated and/or invalidated, then the filesystem must lock +the page, then ensure it is not already truncated (the page lock will block +subsequent truncate), and then return with VM_FAULT_LOCKED, and the page +locked. The VM will unlock the page. + + ->page_mkwrite() is called when a previously read-only pte is +about to become writeable. The filesystem again must ensure that there are +no truncate/invalidate races, and then return with the page locked. If +the page has been truncated, the filesystem should not look up a new page +like the ->fault() handler, but simply return with VM_FAULT_NOPAGE, which +will cause the VM to retry the fault. ->access() is called when get_user_pages() fails in acces_process_vm(), typically used to debug a process through
Makefile +1 -1
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 27 -EXTRAVERSION = .23 +EXTRAVERSION = .24 NAME = Trembling Tortoise # *DOCUMENTATION*
drivers/i2c/algos/i2c-algo-bit.c +1 -1
@@ -104,7 +104,7 @@ static int sclhi(struct i2c_algo_bit_data *adap)* chips may hold it low ("clock stretching") while they * are processing data internally. */ -if (time_after_eq (jiffies, start + adap->timeout)) +if (time_after (jiffies, start + adap->timeout))return -ETIMEDOUT ;cond_resched (); }
drivers/i2c/algos/i2c-algo-pca.c +11 -0
@@ -270,10 +270,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,case 0x30 :/* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ DEB2 ("NOT ACK received after data byte\n" ); +pca_stop (adap); goto out;case 0x38 :/* Arbitration lost during SLA+W, SLA+R or data bytes */ DEB2 ("Arbitration lost\n" ); +/* +* The PCA9564 data sheet (2006-09-01) says "A +* START condition will be transmitted when the +* bus becomes free (STOP or SCL and SDA high)" +* when the STA bit is set (p. 11). +* +* In case this won't work, try pca_reset() +* instead. +*/ +pca_start (adap); goto out;case 0x58 :/* Data byte has been received; NOT ACK has been returned */
drivers/md/bitmap.c +15 -14
@@ -986,6 +986,9 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) oldindex = index; oldpage = page; + bitmap->filemap[bitmap->file_pages++] = page; + bitmap->last_page_size = count; +if (outofdate) {/* * if bitmap is out of date, dirty the
@@ -998,15 +1001,9 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)write_page (bitmap, page,1 ); ret = -EIO ; -if (bitmap->flags &BITMAP_WRITE_ERROR ) { -/* release, page not in filemap yet */ -put_page (page); +if (bitmap->flags &BITMAP_WRITE_ERROR ) goto err; - } } - - bitmap->filemap[bitmap->file_pages++] = page; - bitmap->last_page_size = count; } paddr =kmap_atomic (page,KM_USER0 );if (bitmap->flags &BITMAP_HOSTENDIAN )
@@ -1016,9 +1013,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)kunmap_atomic (paddr,KM_USER0 );if (b) {/* if the disk bit is set, set the memory bit */ -bitmap_set_memory_bits (bitmap, i <<CHUNK_BLOCK_SHIFT (bitmap), - ((i+1 ) << (CHUNK_BLOCK_SHIFT (bitmap)) >= start) - ); +int needed = ((sector_t)(i+1 ) << (CHUNK_BLOCK_SHIFT (bitmap)) + >= start); +bitmap_set_memory_bits (bitmap, + (sector_t )i <<CHUNK_BLOCK_SHIFT (bitmap), + needed); bit_cnt++;set_page_attr (bitmap, page,BITMAP_PAGE_CLEAN ); }
@@ -1154,8 +1153,9 @@ void bitmap_daemon_work(struct bitmap *bitmap)spin_lock_irqsave (&bitmap->lock, flags);clear_page_attr (bitmap, page,BITMAP_PAGE_CLEAN ); } - bmc =bitmap_get_counter (bitmap, j <<CHUNK_BLOCK_SHIFT (bitmap), - &blocks,0 ); + bmc =bitmap_get_counter (bitmap, + (sector_t )j <<CHUNK_BLOCK_SHIFT (bitmap), + &blocks,0 );if (bmc) {/* if (j < 100) printk("bitmap: j=%lu, *bmc = 0x%x\n", j, *bmc);
@@ -1169,7 +1169,8 @@ void bitmap_daemon_work(struct bitmap *bitmap) }else if (*bmc ==1 ) {/* we can clear the bit */ *bmc =0 ; -bitmap_count_page (bitmap, j <<CHUNK_BLOCK_SHIFT (bitmap), +bitmap_count_page (bitmap, + (sector_t )j <<CHUNK_BLOCK_SHIFT (bitmap),-1 );/* clear the bit */
@@ -1485,7 +1486,7 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e)unsigned long chunk;for (chunk = s; chunk <= e; chunk++) { -sector_t sec = chunk <<CHUNK_BLOCK_SHIFT (bitmap); +sector_t sec = (sector_t )chunk <<CHUNK_BLOCK_SHIFT (bitmap);bitmap_set_memory_bits (bitmap, sec,1 );bitmap_file_set_bit (bitmap, sec); }
drivers/md/md.c +2 -5
@@ -2772,11 +2772,8 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) }else err = -EBUSY ;spin_unlock_irq (&mddev->write_lock); - }else { - mddev->ro =0 ; - mddev->recovery_cp = MaxSector; - err =do_md_run (mddev); - } + }else + err = -EINVAL ;break ;case active:if (mddev->pers) {
drivers/md/raid10.c +6 -6
@@ -1805,17 +1805,17 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i r10_bio->sector = sect;raid10_find_phys (conf, r10_bio); -/* Need to check if this section will still be + +/* Need to check if the array will still be * degraded */ -for (j=0 ; j<conf->copies;j++) { -int d = r10_bio->devs[j].devnum; -if (conf->mirrors[d].rdev ==NULL || -test_bit (Faulty, &conf->mirrors[d].rdev->flags)) { +for (j=0 ; j<conf->raid_disks; j++) +if (conf->mirrors[j].rdev ==NULL || +test_bit (Faulty, &conf->mirrors[j].rdev->flags)) { still_degraded =1 ;break ; } - } + must_sync =bitmap_start_sync (mddev->bitmap, sect, &sync_blocks, still_degraded);
drivers/net/ehea/ehea_main.c +18 -13
@@ -529,14 +529,17 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, x &= (arr_len -1 ); pref = skb_array[x]; -prefetchw (pref); -prefetchw (pref +EHEA_CACHE_LINE ); - - pref = (skb_array[x]->data); -prefetch (pref); -prefetch (pref +EHEA_CACHE_LINE ); -prefetch (pref +EHEA_CACHE_LINE *2 ); -prefetch (pref +EHEA_CACHE_LINE *3 ); +if (pref) { +prefetchw (pref); +prefetchw (pref +EHEA_CACHE_LINE ); + + pref = (skb_array[x]->data); +prefetch (pref); +prefetch (pref +EHEA_CACHE_LINE ); +prefetch (pref +EHEA_CACHE_LINE *2 ); +prefetch (pref +EHEA_CACHE_LINE *3 ); + } + skb = skb_array[skb_index]; skb_array[skb_index] =NULL ;return skb;
@@ -553,12 +556,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array, x &= (arr_len -1 ); pref = skb_array[x]; -prefetchw (pref); -prefetchw (pref +EHEA_CACHE_LINE ); +if (pref) { +prefetchw (pref); +prefetchw (pref +EHEA_CACHE_LINE ); - pref = (skb_array[x]->data); -prefetchw (pref); -prefetchw (pref +EHEA_CACHE_LINE ); + pref = (skb_array[x]->data); +prefetchw (pref); +prefetchw (pref +EHEA_CACHE_LINE ); + } skb = skb_array[wqe_index]; skb_array[wqe_index] =NULL ;
drivers/serial/mpc52xx_uart.c +1 -1
@@ -515,7 +515,7 @@ mpc52xx_uart_startup(struct uart_port *port)/* Request IRQ */ ret =request_irq (port->irq, mpc52xx_uart_int, -IRQF_DISABLED |IRQF_SAMPLE_RANDOM |IRQF_SHARED , +IRQF_DISABLED |IRQF_SAMPLE_RANDOM ,"mpc52xx_psc_uart" , port);if (ret)return ret;
drivers/usb/gadget/usbstring.c +3 -3
@@ -38,7 +38,7 @@ static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) uchar = (c &0x1f ) <<6 ; c = (u8) *s++; -if ((c &0xc0 ) !=0xc0 ) +if ((c &0xc0 ) !=0x80 ) goto fail; c &=0x3f ; uchar |= c;
@@ -49,13 +49,13 @@ static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) uchar = (c &0x0f ) <<12 ; c = (u8) *s++; -if ((c &0xc0 ) !=0xc0 ) +if ((c &0xc0 ) !=0x80 ) goto fail; c &=0x3f ; uchar |= c <<6 ; c = (u8) *s++; -if ((c &0xc0 ) !=0xc0 ) +if ((c &0xc0 ) !=0x80 ) goto fail; c &=0x3f ; uchar |= c;
drivers/video/fb_defio.c +2 -1
@@ -70,8 +70,9 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_fsync);/* vm_ops->page_mkwrite handler */ static int fb_deferred_io_mkwrite (struct vm_area_struct *vma, -struct page *page) +struct vm_fault *vmf) { +struct page *page = vmf->page;struct fb_info *info = vma->vm_private_data;struct fb_deferred_io *fbdefio = info->fbdefio;struct page *cur;
fs/buffer.c +15 -5
@@ -2402,20 +2402,22 @@ int block_commit_write(struct page *page, unsigned from, unsigned to)* unlock the page. */ int -block_page_mkwrite (struct vm_area_struct *vma,struct page *page, +block_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf,get_block_t get_block) { +struct page *page = vmf->page;struct inode *inode = vma->vm_file->f_path.dentry->d_inode;unsigned long end;loff_t size; -int ret = -EINVAL ; +int ret =VM_FAULT_NOPAGE ;/* make the VM retry the fault */ lock_page (page); size =i_size_read (inode);if ((page->mapping != inode->i_mapping) || (page_offset (page) > size)) {/* page got truncated out from underneath us */ - goto out_unlock; +unlock_page (page); + goto out; }/* page is wholly or partially inside EOF */
@@ -2428,8 +2430,16 @@ block_page_mkwrite(struct vm_area_struct *vma, struct page *page,if (!ret) ret =block_commit_write (page,0 , end); -out_unlock: -unlock_page (page); +if (unlikely (ret)) { +unlock_page (page); +if (ret == -ENOMEM ) + ret =VM_FAULT_OOM ; +else /* -ENOSPC, -EIO, etc */ + ret =VM_FAULT_SIGBUS ; + }else + ret =VM_FAULT_LOCKED ; + +out:return ret; }
fs/cifs/cifs_unicode.h +7 -0
@@ -64,6 +64,13 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);#endif /* +* To be safe - for UCS to UTF-8 with strings loaded with the rare long +* characters alloc more to account for such multibyte target UTF-8 +* characters. +*/ +#define UNICODE_NAME_MAX ((4 * NAME_MAX) + 2) + +/* * UniStrcat: Concatenate the second string to the first * * Returns:
fs/cifs/cifssmb.c +8 -9
@@ -91,23 +91,22 @@ static int cifs_strncpy_to_host(char **dst, const char *src, const int maxlen, const bool is_unicode, const struct nls_table *nls_codepage) { -int plen; +int src_len, dst_len;if (is_unicode) { - plen =UniStrnlen ((wchar_t *)src, maxlen); - *dst =kmalloc (plen +2 ,GFP_KERNEL ); + src_len =UniStrnlen ((wchar_t *)src, maxlen); + *dst =kmalloc ((4 * src_len) +2 ,GFP_KERNEL );if (!*dst) goto cifs_strncpy_to_host_ErrExit; -cifs_strfromUCS_le (*dst, (__le16 *)src, plen, nls_codepage); + dst_len =cifs_strfromUCS_le (*dst, (__le16 *)src, src_len, nls_codepage); + (*dst)[dst_len +1 ] =0 ; }else { - plen =strnlen (src, maxlen); - *dst =kmalloc (plen +2 ,GFP_KERNEL ); + src_len =strnlen (src, maxlen); + *dst =kmalloc (src_len +1 ,GFP_KERNEL );if (!*dst) goto cifs_strncpy_to_host_ErrExit; -strncpy (*dst, src, plen); +strlcpy (*dst, src, src_len +1 ); } - (*dst)[plen] =0 ; - (*dst)[plen+1 ] =0 ;/* harmless for ASCII case, needed for Unicode */ return 0 ; cifs_strncpy_to_host_ErrExit:
fs/cifs/connect.c +1 -5
@@ -3549,16 +3549,12 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, BCC(smb_buffer_response)) {kfree (tcon->nativeFileSystem); tcon->nativeFileSystem = -kzalloc (2 *(length +1 ),GFP_KERNEL ); +kzalloc ((4 * length) +2 ,GFP_KERNEL );if (tcon->nativeFileSystem)cifs_strfromUCS_le ( tcon->nativeFileSystem, (__le16 *) bcc_ptr, length, nls_codepage); - bcc_ptr +=2 * length; - bcc_ptr[0 ] =0 ;/* null terminate the string */ - bcc_ptr[1 ] =0 ; - bcc_ptr +=2 ; }/* else do not bother copying these information fields*/ }else {
fs/cifs/misc.c +3 -2
@@ -685,14 +685,15 @@ cifs_convertUCSpath(char *target, const __le16 *source, int maxlen, NLS_MAX_CHARSET_SIZE);if (len >0 ) { j += len; -continue ; + goto overrun_chk; }else { target[j] ='?' ; } } j++;/* make sure we do not overrun callers allocated temp buffer */ -if (j >= (2 *NAME_MAX )) +overrun_chk: +if (j >=UNICODE_NAME_MAX )break ; } cUCS_out:
fs/cifs/readdir.c +1 -1
@@ -1075,7 +1075,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)with the rare long characters alloc more to account for such multibyte target UTF-8 characters. cifs_unicode.c, which actually does the conversion, has the same limit */ - tmp_buf =kmalloc ((2 *NAME_MAX ) +4 ,GFP_KERNEL ); + tmp_buf =kmalloc (UNICODE_NAME_MAX ,GFP_KERNEL );for (i =0 ; (i < num_to_fill) && (rc ==0 ); i++) {if (current_entry ==NULL ) {/* evaluate whether this case is an error */
fs/cifs/sess.c +23 -21
75 lines not on this page · raw message
fs/eventpoll.c +1 -1
@@ -1132,7 +1132,7 @@ error_return: SYSCALL_DEFINE1(epoll_create, int, size) { -if (size <0 ) +if (size <=0 )return -EINVAL ;return sys_epoll_create1 (0 );
fs/ext4/ext4.h +1 -1
@@ -1084,7 +1084,7 @@ extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks);extern int ext4_chunk_trans_blocks (struct inode *,int nrblocks);extern int ext4_block_truncate_page (handle_t *handle,struct address_space *mapping,loff_t from); -extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct page *page); +extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf);/* ioctl.c */ extern long ext4_ioctl (struct file *,unsigned int ,unsigned long );
fs/ext4/inode.c +4 -1
@@ -4861,8 +4861,9 @@ static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh)return !buffer_mapped (bh); } -int ext4_page_mkwrite (struct vm_area_struct *vma,struct page *page) +int ext4_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;loff_t size;unsigned long len;int ret = -EINVAL ;
@@ -4913,6 +4914,8 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page) goto out_unlock; ret =0 ; out_unlock: +if (ret) + ret =VM_FAULT_SIGBUS ;up_read (&inode->i_alloc_sem);return ret; }
fs/fcntl.c +4 -2
@@ -117,11 +117,13 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd) {if (unlikely (newfd == oldfd)) {/* corner case */ struct files_struct *files = current->files; +int retval = oldfd; +rcu_read_lock ();if (!fcheck_files (files, oldfd)) - oldfd = -EBADF ; + retval = -EBADF ;rcu_read_unlock (); -return oldfd; +return retval; }return sys_dup3 (oldfd, newfd,0 ); }
fs/fuse/file.c +2 -1
@@ -1219,8 +1219,9 @@ static void fuse_vma_close(struct vm_area_struct *vma)* - sync(2) * - try_to_free_pages() with order > PAGE_ALLOC_COSTLY_ORDER */ -static int fuse_page_mkwrite (struct vm_area_struct *vma,struct page *page) +static int fuse_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;/* * Don't use page->mapping as it may become NULL from a * concurrent truncate.
fs/gfs2/ops_file.c +6 -1
@@ -338,8 +338,9 @@ static int gfs2_allocate_page_backing(struct page *page)* blocks allocated on disk to back that page. */ -static int gfs2_page_mkwrite (struct vm_area_struct *vma,struct page *page) +static int gfs2_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;struct inode *inode = vma->vm_file->f_path.dentry->d_inode;struct gfs2_inode *ip =GFS2_I (inode);struct gfs2_sbd *sdp =GFS2_SB (inode);
@@ -411,6 +412,10 @@ out_unlock:gfs2_glock_dq (&gh); out:gfs2_holder_uninit (&gh); +if (ret == -ENOMEM ) + ret =VM_FAULT_OOM ; +else if (ret) + ret =VM_FAULT_SIGBUS ;return ret; }
fs/nfs/dir.c +4 -5
@@ -1613,8 +1613,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, }else if (atomic_read (&new_dentry->d_count) >1 )/* dentry still busy? */ goto out; - }else -nfs_drop_nlink (new_inode); + } go_ahead:/*
@@ -1627,10 +1626,8 @@ go_ahead: }nfs_inode_return_delegation (old_inode); -if (new_inode !=NULL ) { +if (new_inode !=NULL )nfs_inode_return_delegation (new_inode); -d_delete (new_dentry); - } error =NFS_PROTO (old_dir)->rename (old_dir, &old_dentry->d_name, new_dir, &new_dentry->d_name);
@@ -1639,6 +1636,8 @@ out:if (rehash)d_rehash (rehash);if (!error) { +if (new_inode !=NULL ) +nfs_drop_nlink (new_inode);d_move (old_dentry, new_dentry);nfs_set_verifier (new_dentry,nfs_save_change_attribute (new_dir));
fs/nfs/file.c +5 -4
@@ -448,8 +448,9 @@ const struct address_space_operations nfs_file_aops = { .launder_page = nfs_launder_page, }; -static int nfs_vm_page_mkwrite (struct vm_area_struct *vma,struct page *page) +static int nfs_vm_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;struct file *filp = vma->vm_file;struct dentry *dentry = filp->f_path.dentry;unsigned pagelen;
@@ -476,11 +477,11 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) goto out_unlock; ret =nfs_updatepage (filp, page,0 , pagelen); -if (ret ==0 ) - ret = pagelen; out_unlock: +if (!ret) +return VM_FAULT_LOCKED ;unlock_page (page); -return ret; +return VM_FAULT_SIGBUS ; }static struct vm_operations_struct nfs_file_vm_ops = {
fs/nfsd/nfs4xdr.c +15 -1
@@ -1833,6 +1833,15 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, dentry =lookup_one_len (name, cd->rd_fhp->fh_dentry, namlen);if (IS_ERR (dentry))return nfserrno (PTR_ERR (dentry)); +if (!dentry->d_inode) { +/* +* nfsd_buffered_readdir drops the i_mutex between +* readdir and calling this callback, leaving a window +* where this directory entry could have gone away. +*/ +dput (dentry); +return nfserr_noent; + }exp_get (exp);/*
@@ -1895,6 +1904,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);int buflen;__be32 *p = cd->buffer; +__be32 *cookiep;__be32 nfserr = nfserr_toosmall;/* In nfsv4, "." and ".." never make it onto the wire.. */
@@ -1911,7 +1921,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, goto fail; *p++ = xdr_one;/* mark entry present */ - cd->offset = p;/* remember pointer */ + cookiep = p; p =xdr_encode_hyper (p,NFS_OFFSET_MAX );/* offset of next entry */ p =xdr_encode_array (p, name, namlen);/* name length & name */
@@ -1925,6 +1935,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, goto fail;case nfserr_dropit: goto fail; +case nfserr_noent: + goto skip_entry;default :/* * If the client requested the RDATTR_ERROR attribute,
@@ -1943,6 +1955,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, } cd->buflen -= (p - cd->buffer); cd->buffer = p; + cd->offset = cookiep; +skip_entry: cd->common.err = nfs_ok;return 0 ; fail:
fs/ocfs2/file.c +74 -20
118 lines not on this page · raw message
fs/ocfs2/mmap.c +4 -2
@@ -150,8 +150,9 @@ out:return ret; } -static int ocfs2_page_mkwrite (struct vm_area_struct *vma,struct page *page) +static int ocfs2_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;struct inode *inode = vma->vm_file->f_path.dentry->d_inode;struct buffer_head *di_bh =NULL ;sigset_t blocked, oldset;
@@ -192,7 +193,8 @@ out: ret2 =ocfs2_vm_op_unblock_sigs (&oldset);if (ret2 <0 )mlog_errno (ret2); - +if (ret) + ret =VM_FAULT_SIGBUS ;return ret; }
fs/splice.c +171 -103
342 lines not on this page · raw message
fs/ubifs/file.c +6 -3
@@ -1140,8 +1140,9 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)* mmap()d file has taken write protection fault and is being made * writable. UBIFS must ensure page is budgeted for. */ -static int ubifs_vm_page_mkwrite (struct vm_area_struct *vma,struct page *page) +static int ubifs_vm_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) { +struct page *page = vmf->page;struct inode *inode = vma->vm_file->f_path.dentry->d_inode;struct ubifs_info *c = inode->i_sb->s_fs_info;struct timespec now =ubifs_current_time (inode);
@@ -1153,7 +1154,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)ubifs_assert (!(inode->i_sb->s_flags &MS_RDONLY ));if (unlikely (c->ro_media)) -return -EROFS ; +return VM_FAULT_SIGBUS ;/* -EROFS */ /* * We have not locked @page so far so we may budget for changing the
@@ -1186,7 +1187,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)if (err == -ENOSPC )ubifs_warn ("out of space for mmapped file " "(inode number %lu)" , inode->i_ino); -return err; +return VM_FAULT_SIGBUS ; }lock_page (page);
@@ -1226,6 +1227,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page) out_unlock:unlock_page (page);ubifs_release_budget (c, &req); +if (err) + err =VM_FAULT_SIGBUS ;return err; }
fs/xfs/linux-2.6/xfs_file.c +2 -2
@@ -427,9 +427,9 @@ xfs_file_ioctl_invis( STATIC intxfs_vm_page_mkwrite (struct vm_area_struct *vma, -struct page *page) +struct vm_fault *vmf) { -return block_page_mkwrite (vma, page, xfs_get_blocks); +return block_page_mkwrite (vma, vmf, xfs_get_blocks); }const struct file_operations xfs_file_operations = {
include/linux/buffer_head.h +1 -1
@@ -222,7 +222,7 @@ int cont_write_begin(struct file *, struct address_space *, loff_t, get_block_t *, loff_t *);int generic_cont_expand_simple (struct inode *inode,loff_t size);int block_commit_write (struct page *page,unsigned from,unsigned to); -int block_page_mkwrite (struct vm_area_struct *vma,struct page *page, +int block_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf,get_block_t get_block);void block_sync_page (struct page *);sector_t generic_block_bmap (struct address_space *,sector_t ,get_block_t *);
include/linux/mm.h +2 -1
@@ -138,6 +138,7 @@ extern pgprot_t protection_map[16];#define FAULT_FLAG_WRITE 0x01/* Fault was a write access */ #define FAULT_FLAG_NONLINEAR 0x02/* Fault was via a nonlinear mapping */ +#define FAULT_FLAG_MKWRITE 0x04/* Fault was mkwrite of existing pte */ /*
@@ -173,7 +174,7 @@ struct vm_operations_struct {/* notification that a previously read-only page is about to become * writable, if an error is returned it will cause a SIGBUS */ -int (*page_mkwrite)(struct vm_area_struct *vma,struct page *page); +int (*page_mkwrite)(struct vm_area_struct *vma,struct vm_fault *vmf);/* called by access_process_vm when get_user_pages() fails, typically * for use by special VMAs that can switch between memory and hardware
include/linux/splice.h +12 -0
@@ -36,6 +36,8 @@ struct splice_desc {void *data;/* cookie */ } u;loff_t pos;/* file position */ +size_t num_spliced;/* number of bytes already spliced */ +bool need_wakeup;/* need to wake up writer */ };struct partial_page {
@@ -66,6 +68,16 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *, splice_actor *);extern ssize_t __splice_from_pipe (struct pipe_inode_info *,struct splice_desc *,splice_actor *); +extern int splice_from_pipe_feed (struct pipe_inode_info *,struct splice_desc *, +splice_actor *); +extern int splice_from_pipe_next (struct pipe_inode_info *, +struct splice_desc *); +extern void splice_from_pipe_begin (struct splice_desc *); +extern void splice_from_pipe_end (struct pipe_inode_info *, +struct splice_desc *); +extern int pipe_to_file (struct pipe_inode_info *,struct pipe_buffer *, +struct splice_desc *); +extern ssize_t splice_to_pipe (struct pipe_inode_info *,struct splice_pipe_desc *); extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
mm/memory.c +97 -35
194 lines not on this page · raw message