diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-08-23 05:43:14 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-08-23 05:43:14 -0400 |
commit | ac0c955d5048c2c580fa7166a89133f0fd76c125 (patch) | |
tree | 041ac4fb544c7244a1a0b35c8ceabc142d5645c1 /fs | |
parent | 68d09b1b6780415d82160f6b6d88e82bd724e691 (diff) | |
parent | b377fd3982ad957c796758a90e2988401a884241 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/root.c | 31 | ||||
-rw-r--r-- | fs/cifs/CHANGES | 5 | ||||
-rw-r--r-- | fs/cifs/README | 13 | ||||
-rw-r--r-- | fs/cifs/TODO | 3 | ||||
-rw-r--r-- | fs/cifs/file.c | 33 | ||||
-rw-r--r-- | fs/cifs/sess.c | 4 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 3 | ||||
-rw-r--r-- | fs/direct-io.c | 17 | ||||
-rw-r--r-- | fs/dlm/lock.c | 69 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 24 | ||||
-rw-r--r-- | fs/dlm/member.c | 4 | ||||
-rw-r--r-- | fs/dlm/rcom.c | 7 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 8 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 18 | ||||
-rw-r--r-- | fs/exec.c | 25 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 6 | ||||
-rw-r--r-- | fs/gfs2/mount.c | 25 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 3 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 29 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 16 | ||||
-rw-r--r-- | fs/jffs2/write.c | 3 | ||||
-rw-r--r-- | fs/nfs/delegation.c | 21 | ||||
-rw-r--r-- | fs/nfs/inode.c | 24 | ||||
-rw-r--r-- | fs/nfs/namespace.c | 6 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 16 | ||||
-rw-r--r-- | fs/nfs/nfs4renewd.c | 5 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/alloc.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 24 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 28 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 8 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 69 | ||||
-rw-r--r-- | fs/ocfs2/super.h | 2 | ||||
-rw-r--r-- | fs/signalfd.c | 14 |
35 files changed, 368 insertions, 220 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 2d4c8a3e604e..45ff3d63b758 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -587,19 +587,20 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); | 587 | unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); |
588 | if (!unhashed) { | 588 | if (!unhashed) { |
589 | /* | 589 | /* |
590 | * Mark the dentry incomplete, but add it. This is needed so | 590 | * Mark the dentry incomplete but don't hash it. We do this |
591 | * that the VFS layer knows about the dentry, and we can count | 591 | * to serialize our inode creation operations (symlink and |
592 | * on catching any lookups through the revalidate. | 592 | * mkdir) which prevents deadlock during the callback to |
593 | * | 593 | * the daemon. Subsequent user space lookups for the same |
594 | * Let all the hard work be done by the revalidate function that | 594 | * dentry are placed on the wait queue while the daemon |
595 | * needs to be able to do this anyway.. | 595 | * itself is allowed passage unresticted so the create |
596 | * | 596 | * operation itself can then hash the dentry. Finally, |
597 | * We need to do this before we release the directory semaphore. | 597 | * we check for the hashed dentry and return the newly |
598 | * hashed dentry. | ||
598 | */ | 599 | */ |
599 | dentry->d_op = &autofs4_root_dentry_operations; | 600 | dentry->d_op = &autofs4_root_dentry_operations; |
600 | 601 | ||
601 | dentry->d_fsdata = NULL; | 602 | dentry->d_fsdata = NULL; |
602 | d_add(dentry, NULL); | 603 | d_instantiate(dentry, NULL); |
603 | } else { | 604 | } else { |
604 | struct autofs_info *ino = autofs4_dentry_ino(unhashed); | 605 | struct autofs_info *ino = autofs4_dentry_ino(unhashed); |
605 | DPRINTK("rehash %p with %p", dentry, unhashed); | 606 | DPRINTK("rehash %p with %p", dentry, unhashed); |
@@ -607,15 +608,17 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
607 | * If we are racing with expire the request might not | 608 | * If we are racing with expire the request might not |
608 | * be quite complete but the directory has been removed | 609 | * be quite complete but the directory has been removed |
609 | * so it must have been successful, so just wait for it. | 610 | * so it must have been successful, so just wait for it. |
611 | * We need to ensure the AUTOFS_INF_EXPIRING flag is clear | ||
612 | * before continuing as revalidate may fail when calling | ||
613 | * try_to_fill_dentry (returning EAGAIN) if we don't. | ||
610 | */ | 614 | */ |
611 | if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) { | 615 | while (ino && (ino->flags & AUTOFS_INF_EXPIRING)) { |
612 | DPRINTK("wait for incomplete expire %p name=%.*s", | 616 | DPRINTK("wait for incomplete expire %p name=%.*s", |
613 | unhashed, unhashed->d_name.len, | 617 | unhashed, unhashed->d_name.len, |
614 | unhashed->d_name.name); | 618 | unhashed->d_name.name); |
615 | autofs4_wait(sbi, unhashed, NFY_NONE); | 619 | autofs4_wait(sbi, unhashed, NFY_NONE); |
616 | DPRINTK("request completed"); | 620 | DPRINTK("request completed"); |
617 | } | 621 | } |
618 | d_rehash(unhashed); | ||
619 | dentry = unhashed; | 622 | dentry = unhashed; |
620 | } | 623 | } |
621 | 624 | ||
@@ -658,7 +661,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
658 | * for all system calls, but it should be OK for the operations | 661 | * for all system calls, but it should be OK for the operations |
659 | * we permit from an autofs. | 662 | * we permit from an autofs. |
660 | */ | 663 | */ |
661 | if (dentry->d_inode && d_unhashed(dentry)) { | 664 | if (!oz_mode && d_unhashed(dentry)) { |
662 | /* | 665 | /* |
663 | * A user space application can (and has done in the past) | 666 | * A user space application can (and has done in the past) |
664 | * remove and re-create this directory during the callback. | 667 | * remove and re-create this directory during the callback. |
@@ -716,7 +719,7 @@ static int autofs4_dir_symlink(struct inode *dir, | |||
716 | strcpy(cp, symname); | 719 | strcpy(cp, symname); |
717 | 720 | ||
718 | inode = autofs4_get_inode(dir->i_sb, ino); | 721 | inode = autofs4_get_inode(dir->i_sb, ino); |
719 | d_instantiate(dentry, inode); | 722 | d_add(dentry, inode); |
720 | 723 | ||
721 | if (dir == dir->i_sb->s_root->d_inode) | 724 | if (dir == dir->i_sb->s_root->d_inode) |
722 | dentry->d_op = &autofs4_root_dentry_operations; | 725 | dentry->d_op = &autofs4_root_dentry_operations; |
@@ -844,7 +847,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
844 | return -ENOSPC; | 847 | return -ENOSPC; |
845 | 848 | ||
846 | inode = autofs4_get_inode(dir->i_sb, ino); | 849 | inode = autofs4_get_inode(dir->i_sb, ino); |
847 | d_instantiate(dentry, inode); | 850 | d_add(dentry, inode); |
848 | 851 | ||
849 | if (dir == dir->i_sb->s_root->d_inode) | 852 | if (dir == dir->i_sb->s_root->d_inode) |
850 | dentry->d_op = &autofs4_root_dentry_operations; | 853 | dentry->d_op = &autofs4_root_dentry_operations; |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 6d84ca2beead..bed6215c0794 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -3,7 +3,10 @@ Version 1.50 | |||
3 | Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is | 3 | Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is |
4 | done with "serverino" mount option). Add support for POSIX Unlink | 4 | done with "serverino" mount option). Add support for POSIX Unlink |
5 | (helps with certain sharing violation cases when server such as | 5 | (helps with certain sharing violation cases when server such as |
6 | Samba supports newer POSIX CIFS Protocol Extensions). | 6 | Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix" |
7 | mount option to allow disabling the CIFS Unix Extensions for just | ||
8 | that mount. Fix hang on spinlock in find_writable_file (race when | ||
9 | reopening file after session crash). | ||
7 | 10 | ||
8 | Version 1.49 | 11 | Version 1.49 |
9 | ------------ | 12 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index 85f1eb14083e..b806b11b5560 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -444,6 +444,13 @@ A partial list of the supported mount options follows: | |||
444 | noposixpaths If CIFS Unix extensions are supported, do not request | 444 | noposixpaths If CIFS Unix extensions are supported, do not request |
445 | posix path name support (this may cause servers to | 445 | posix path name support (this may cause servers to |
446 | reject creatingfile with certain reserved characters). | 446 | reject creatingfile with certain reserved characters). |
447 | nounix Disable the CIFS Unix Extensions for this mount (tree | ||
448 | connection). This is rarely needed, but it may be useful | ||
449 | in order to turn off multiple settings all at once (ie | ||
450 | posix acls, posix locks, posix paths, symlink support | ||
451 | and retrieving uids/gids/mode from the server) or to | ||
452 | work around a bug in server which implement the Unix | ||
453 | Extensions. | ||
447 | nobrl Do not send byte range lock requests to the server. | 454 | nobrl Do not send byte range lock requests to the server. |
448 | This is necessary for certain applications that break | 455 | This is necessary for certain applications that break |
449 | with cifs style mandatory byte range locks (and most | 456 | with cifs style mandatory byte range locks (and most |
@@ -451,6 +458,12 @@ A partial list of the supported mount options follows: | |||
451 | byte range locks). | 458 | byte range locks). |
452 | remount remount the share (often used to change from ro to rw mounts | 459 | remount remount the share (often used to change from ro to rw mounts |
453 | or vice versa) | 460 | or vice versa) |
461 | servern Specify the server 's netbios name (RFC1001 name) to use | ||
462 | when attempting to setup a session to the server. This is | ||
463 | This is needed for mounting to some older servers (such | ||
464 | as OS/2 or Windows 98 and Windows ME) since they do not | ||
465 | support a default server name. A server name can be up | ||
466 | to 15 characters long and is usually uppercased. | ||
454 | sfu When the CIFS Unix Extensions are not negotiated, attempt to | 467 | sfu When the CIFS Unix Extensions are not negotiated, attempt to |
455 | create device files and fifos in a format compatible with | 468 | create device files and fifos in a format compatible with |
456 | Services for Unix (SFU). In addition retrieve bits 10-12 | 469 | Services for Unix (SFU). In addition retrieve bits 10-12 |
diff --git a/fs/cifs/TODO b/fs/cifs/TODO index d7bd51575fd6..29d4b2715254 100644 --- a/fs/cifs/TODO +++ b/fs/cifs/TODO | |||
@@ -82,8 +82,7 @@ u) DOS attrs - returned as pseudo-xattr in Samba format (check VFAT and NTFS for | |||
82 | 82 | ||
83 | v) mount check for unmatched uids | 83 | v) mount check for unmatched uids |
84 | 84 | ||
85 | w) Add mount option for Linux extension disable per mount, and partial | 85 | w) Add support for new vfs entry points for setlease and fallocate |
86 | disable per mount (uid off, symlink/fifo/mknod on but what about posix acls?) | ||
87 | 86 | ||
88 | x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of | 87 | x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of |
89 | processes can proceed better in parallel (on the server) | 88 | processes can proceed better in parallel (on the server) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e13592afca9c..894b1f7b299d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1904,6 +1904,25 @@ static int cifs_readpage(struct file *file, struct page *page) | |||
1904 | return rc; | 1904 | return rc; |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | static int is_inode_writable(struct cifsInodeInfo *cifs_inode) | ||
1908 | { | ||
1909 | struct cifsFileInfo *open_file; | ||
1910 | |||
1911 | read_lock(&GlobalSMBSeslock); | ||
1912 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { | ||
1913 | if (open_file->closePend) | ||
1914 | continue; | ||
1915 | if (open_file->pfile && | ||
1916 | ((open_file->pfile->f_flags & O_RDWR) || | ||
1917 | (open_file->pfile->f_flags & O_WRONLY))) { | ||
1918 | read_unlock(&GlobalSMBSeslock); | ||
1919 | return 1; | ||
1920 | } | ||
1921 | } | ||
1922 | read_unlock(&GlobalSMBSeslock); | ||
1923 | return 0; | ||
1924 | } | ||
1925 | |||
1907 | /* We do not want to update the file size from server for inodes | 1926 | /* We do not want to update the file size from server for inodes |
1908 | open for write - to avoid races with writepage extending | 1927 | open for write - to avoid races with writepage extending |
1909 | the file - in the future we could consider allowing | 1928 | the file - in the future we could consider allowing |
@@ -1912,19 +1931,13 @@ static int cifs_readpage(struct file *file, struct page *page) | |||
1912 | page caching in the current Linux kernel design */ | 1931 | page caching in the current Linux kernel design */ |
1913 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | 1932 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
1914 | { | 1933 | { |
1915 | struct cifsFileInfo *open_file = NULL; | 1934 | if (!cifsInode) |
1916 | 1935 | return 1; | |
1917 | if (cifsInode) | ||
1918 | open_file = find_writable_file(cifsInode); | ||
1919 | 1936 | ||
1920 | if (open_file) { | 1937 | if (is_inode_writable(cifsInode)) { |
1938 | /* This inode is open for write at least once */ | ||
1921 | struct cifs_sb_info *cifs_sb; | 1939 | struct cifs_sb_info *cifs_sb; |
1922 | 1940 | ||
1923 | /* there is not actually a write pending so let | ||
1924 | this handle go free and allow it to | ||
1925 | be closable if needed */ | ||
1926 | atomic_dec(&open_file->wrtPending); | ||
1927 | |||
1928 | cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); | 1941 | cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); |
1929 | if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { | 1942 | if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { |
1930 | /* since no page cache to corrupt on directio | 1943 | /* since no page cache to corrupt on directio |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 2ea027dda215..892be9b4d1f3 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, | |||
372 | 372 | ||
373 | /* 2000 big enough to fit max user, domain, NOS name etc. */ | 373 | /* 2000 big enough to fit max user, domain, NOS name etc. */ |
374 | str_area = kmalloc(2000, GFP_KERNEL); | 374 | str_area = kmalloc(2000, GFP_KERNEL); |
375 | if (str_area == NULL) { | ||
376 | cifs_small_buf_release(smb_buf); | ||
377 | return -ENOMEM; | ||
378 | } | ||
375 | bcc_ptr = str_area; | 379 | bcc_ptr = str_area; |
376 | 380 | ||
377 | ses->flags &= ~CIFS_SES_LANMAN; | 381 | ses->flags &= ~CIFS_SES_LANMAN; |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 2bc1428d621c..a6c9078af124 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -3161,12 +3161,9 @@ COMPATIBLE_IOCTL(SIOCSIWSENS) | |||
3161 | COMPATIBLE_IOCTL(SIOCGIWSENS) | 3161 | COMPATIBLE_IOCTL(SIOCGIWSENS) |
3162 | COMPATIBLE_IOCTL(SIOCSIWRANGE) | 3162 | COMPATIBLE_IOCTL(SIOCSIWRANGE) |
3163 | COMPATIBLE_IOCTL(SIOCSIWPRIV) | 3163 | COMPATIBLE_IOCTL(SIOCSIWPRIV) |
3164 | COMPATIBLE_IOCTL(SIOCGIWPRIV) | ||
3165 | COMPATIBLE_IOCTL(SIOCSIWSTATS) | 3164 | COMPATIBLE_IOCTL(SIOCSIWSTATS) |
3166 | COMPATIBLE_IOCTL(SIOCGIWSTATS) | ||
3167 | COMPATIBLE_IOCTL(SIOCSIWAP) | 3165 | COMPATIBLE_IOCTL(SIOCSIWAP) |
3168 | COMPATIBLE_IOCTL(SIOCGIWAP) | 3166 | COMPATIBLE_IOCTL(SIOCGIWAP) |
3169 | COMPATIBLE_IOCTL(SIOCSIWSCAN) | ||
3170 | COMPATIBLE_IOCTL(SIOCSIWRATE) | 3167 | COMPATIBLE_IOCTL(SIOCSIWRATE) |
3171 | COMPATIBLE_IOCTL(SIOCGIWRATE) | 3168 | COMPATIBLE_IOCTL(SIOCGIWRATE) |
3172 | COMPATIBLE_IOCTL(SIOCSIWRTS) | 3169 | COMPATIBLE_IOCTL(SIOCSIWRTS) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 52bb2638f7ab..901dc55e9f54 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -958,35 +958,22 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
958 | ssize_t ret2; | 958 | ssize_t ret2; |
959 | size_t bytes; | 959 | size_t bytes; |
960 | 960 | ||
961 | dio->bio = NULL; | ||
962 | dio->inode = inode; | 961 | dio->inode = inode; |
963 | dio->rw = rw; | 962 | dio->rw = rw; |
964 | dio->blkbits = blkbits; | 963 | dio->blkbits = blkbits; |
965 | dio->blkfactor = inode->i_blkbits - blkbits; | 964 | dio->blkfactor = inode->i_blkbits - blkbits; |
966 | dio->start_zero_done = 0; | ||
967 | dio->size = 0; | ||
968 | dio->block_in_file = offset >> blkbits; | 965 | dio->block_in_file = offset >> blkbits; |
969 | dio->blocks_available = 0; | ||
970 | dio->cur_page = NULL; | ||
971 | 966 | ||
972 | dio->boundary = 0; | ||
973 | dio->reap_counter = 0; | ||
974 | dio->get_block = get_block; | 967 | dio->get_block = get_block; |
975 | dio->end_io = end_io; | 968 | dio->end_io = end_io; |
976 | dio->map_bh.b_private = NULL; | ||
977 | dio->final_block_in_bio = -1; | 969 | dio->final_block_in_bio = -1; |
978 | dio->next_block_for_io = -1; | 970 | dio->next_block_for_io = -1; |
979 | 971 | ||
980 | dio->page_errors = 0; | ||
981 | dio->io_error = 0; | ||
982 | dio->result = 0; | ||
983 | dio->iocb = iocb; | 972 | dio->iocb = iocb; |
984 | dio->i_size = i_size_read(inode); | 973 | dio->i_size = i_size_read(inode); |
985 | 974 | ||
986 | spin_lock_init(&dio->bio_lock); | 975 | spin_lock_init(&dio->bio_lock); |
987 | dio->refcount = 1; | 976 | dio->refcount = 1; |
988 | dio->bio_list = NULL; | ||
989 | dio->waiter = NULL; | ||
990 | 977 | ||
991 | /* | 978 | /* |
992 | * In case of non-aligned buffers, we may need 2 more | 979 | * In case of non-aligned buffers, we may need 2 more |
@@ -994,8 +981,6 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
994 | */ | 981 | */ |
995 | if (unlikely(dio->blkfactor)) | 982 | if (unlikely(dio->blkfactor)) |
996 | dio->pages_in_io = 2; | 983 | dio->pages_in_io = 2; |
997 | else | ||
998 | dio->pages_in_io = 0; | ||
999 | 984 | ||
1000 | for (seg = 0; seg < nr_segs; seg++) { | 985 | for (seg = 0; seg < nr_segs; seg++) { |
1001 | user_addr = (unsigned long)iov[seg].iov_base; | 986 | user_addr = (unsigned long)iov[seg].iov_base; |
@@ -1183,7 +1168,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1183 | } | 1168 | } |
1184 | } | 1169 | } |
1185 | 1170 | ||
1186 | dio = kmalloc(sizeof(*dio), GFP_KERNEL); | 1171 | dio = kzalloc(sizeof(*dio), GFP_KERNEL); |
1187 | retval = -ENOMEM; | 1172 | retval = -ENOMEM; |
1188 | if (!dio) | 1173 | if (!dio) |
1189 | goto out; | 1174 | goto out; |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index b455919c1998..2082daf083d8 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -1670,9 +1670,10 @@ static int can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now, | |||
1670 | with a deadlk here, we'd have to generate something like grant_lock with | 1670 | with a deadlk here, we'd have to generate something like grant_lock with |
1671 | the deadlk error.) */ | 1671 | the deadlk error.) */ |
1672 | 1672 | ||
1673 | /* returns the highest requested mode of all blocked conversions */ | 1673 | /* Returns the highest requested mode of all blocked conversions; sets |
1674 | cw if there's a blocked conversion to DLM_LOCK_CW. */ | ||
1674 | 1675 | ||
1675 | static int grant_pending_convert(struct dlm_rsb *r, int high) | 1676 | static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw) |
1676 | { | 1677 | { |
1677 | struct dlm_lkb *lkb, *s; | 1678 | struct dlm_lkb *lkb, *s; |
1678 | int hi, demoted, quit, grant_restart, demote_restart; | 1679 | int hi, demoted, quit, grant_restart, demote_restart; |
@@ -1709,6 +1710,9 @@ static int grant_pending_convert(struct dlm_rsb *r, int high) | |||
1709 | } | 1710 | } |
1710 | 1711 | ||
1711 | hi = max_t(int, lkb->lkb_rqmode, hi); | 1712 | hi = max_t(int, lkb->lkb_rqmode, hi); |
1713 | |||
1714 | if (cw && lkb->lkb_rqmode == DLM_LOCK_CW) | ||
1715 | *cw = 1; | ||
1712 | } | 1716 | } |
1713 | 1717 | ||
1714 | if (grant_restart) | 1718 | if (grant_restart) |
@@ -1721,29 +1725,52 @@ static int grant_pending_convert(struct dlm_rsb *r, int high) | |||
1721 | return max_t(int, high, hi); | 1725 | return max_t(int, high, hi); |
1722 | } | 1726 | } |
1723 | 1727 | ||
1724 | static int grant_pending_wait(struct dlm_rsb *r, int high) | 1728 | static int grant_pending_wait(struct dlm_rsb *r, int high, int *cw) |
1725 | { | 1729 | { |
1726 | struct dlm_lkb *lkb, *s; | 1730 | struct dlm_lkb *lkb, *s; |
1727 | 1731 | ||
1728 | list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) { | 1732 | list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) { |
1729 | if (can_be_granted(r, lkb, 0, NULL)) | 1733 | if (can_be_granted(r, lkb, 0, NULL)) |
1730 | grant_lock_pending(r, lkb); | 1734 | grant_lock_pending(r, lkb); |
1731 | else | 1735 | else { |
1732 | high = max_t(int, lkb->lkb_rqmode, high); | 1736 | high = max_t(int, lkb->lkb_rqmode, high); |
1737 | if (lkb->lkb_rqmode == DLM_LOCK_CW) | ||
1738 | *cw = 1; | ||
1739 | } | ||
1733 | } | 1740 | } |
1734 | 1741 | ||
1735 | return high; | 1742 | return high; |
1736 | } | 1743 | } |
1737 | 1744 | ||
1745 | /* cw of 1 means there's a lock with a rqmode of DLM_LOCK_CW that's blocked | ||
1746 | on either the convert or waiting queue. | ||
1747 | high is the largest rqmode of all locks blocked on the convert or | ||
1748 | waiting queue. */ | ||
1749 | |||
1750 | static int lock_requires_bast(struct dlm_lkb *gr, int high, int cw) | ||
1751 | { | ||
1752 | if (gr->lkb_grmode == DLM_LOCK_PR && cw) { | ||
1753 | if (gr->lkb_highbast < DLM_LOCK_EX) | ||
1754 | return 1; | ||
1755 | return 0; | ||
1756 | } | ||
1757 | |||
1758 | if (gr->lkb_highbast < high && | ||
1759 | !__dlm_compat_matrix[gr->lkb_grmode+1][high+1]) | ||
1760 | return 1; | ||
1761 | return 0; | ||
1762 | } | ||
1763 | |||
1738 | static void grant_pending_locks(struct dlm_rsb *r) | 1764 | static void grant_pending_locks(struct dlm_rsb *r) |
1739 | { | 1765 | { |
1740 | struct dlm_lkb *lkb, *s; | 1766 | struct dlm_lkb *lkb, *s; |
1741 | int high = DLM_LOCK_IV; | 1767 | int high = DLM_LOCK_IV; |
1768 | int cw = 0; | ||
1742 | 1769 | ||
1743 | DLM_ASSERT(is_master(r), dlm_dump_rsb(r);); | 1770 | DLM_ASSERT(is_master(r), dlm_dump_rsb(r);); |
1744 | 1771 | ||
1745 | high = grant_pending_convert(r, high); | 1772 | high = grant_pending_convert(r, high, &cw); |
1746 | high = grant_pending_wait(r, high); | 1773 | high = grant_pending_wait(r, high, &cw); |
1747 | 1774 | ||
1748 | if (high == DLM_LOCK_IV) | 1775 | if (high == DLM_LOCK_IV) |
1749 | return; | 1776 | return; |
@@ -1751,27 +1778,41 @@ static void grant_pending_locks(struct dlm_rsb *r) | |||
1751 | /* | 1778 | /* |
1752 | * If there are locks left on the wait/convert queue then send blocking | 1779 | * If there are locks left on the wait/convert queue then send blocking |
1753 | * ASTs to granted locks based on the largest requested mode (high) | 1780 | * ASTs to granted locks based on the largest requested mode (high) |
1754 | * found above. FIXME: highbast < high comparison not valid for PR/CW. | 1781 | * found above. |
1755 | */ | 1782 | */ |
1756 | 1783 | ||
1757 | list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { | 1784 | list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { |
1758 | if (lkb->lkb_bastaddr && (lkb->lkb_highbast < high) && | 1785 | if (lkb->lkb_bastaddr && lock_requires_bast(lkb, high, cw)) { |
1759 | !__dlm_compat_matrix[lkb->lkb_grmode+1][high+1]) { | 1786 | if (cw && high == DLM_LOCK_PR) |
1760 | queue_bast(r, lkb, high); | 1787 | queue_bast(r, lkb, DLM_LOCK_CW); |
1788 | else | ||
1789 | queue_bast(r, lkb, high); | ||
1761 | lkb->lkb_highbast = high; | 1790 | lkb->lkb_highbast = high; |
1762 | } | 1791 | } |
1763 | } | 1792 | } |
1764 | } | 1793 | } |
1765 | 1794 | ||
1795 | static int modes_require_bast(struct dlm_lkb *gr, struct dlm_lkb *rq) | ||
1796 | { | ||
1797 | if ((gr->lkb_grmode == DLM_LOCK_PR && rq->lkb_rqmode == DLM_LOCK_CW) || | ||
1798 | (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) { | ||
1799 | if (gr->lkb_highbast < DLM_LOCK_EX) | ||
1800 | return 1; | ||
1801 | return 0; | ||
1802 | } | ||
1803 | |||
1804 | if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq)) | ||
1805 | return 1; | ||
1806 | return 0; | ||
1807 | } | ||
1808 | |||
1766 | static void send_bast_queue(struct dlm_rsb *r, struct list_head *head, | 1809 | static void send_bast_queue(struct dlm_rsb *r, struct list_head *head, |
1767 | struct dlm_lkb *lkb) | 1810 | struct dlm_lkb *lkb) |
1768 | { | 1811 | { |
1769 | struct dlm_lkb *gr; | 1812 | struct dlm_lkb *gr; |
1770 | 1813 | ||
1771 | list_for_each_entry(gr, head, lkb_statequeue) { | 1814 | list_for_each_entry(gr, head, lkb_statequeue) { |
1772 | if (gr->lkb_bastaddr && | 1815 | if (gr->lkb_bastaddr && modes_require_bast(gr, lkb)) { |
1773 | gr->lkb_highbast < lkb->lkb_rqmode && | ||
1774 | !modes_compat(gr, lkb)) { | ||
1775 | queue_bast(r, gr, lkb->lkb_rqmode); | 1816 | queue_bast(r, gr, lkb->lkb_rqmode); |
1776 | gr->lkb_highbast = lkb->lkb_rqmode; | 1817 | gr->lkb_highbast = lkb->lkb_rqmode; |
1777 | } | 1818 | } |
@@ -2235,7 +2276,7 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2235 | before we try again to grant this one. */ | 2276 | before we try again to grant this one. */ |
2236 | 2277 | ||
2237 | if (is_demoted(lkb)) { | 2278 | if (is_demoted(lkb)) { |
2238 | grant_pending_convert(r, DLM_LOCK_IV); | 2279 | grant_pending_convert(r, DLM_LOCK_IV, NULL); |
2239 | if (_can_be_granted(r, lkb, 1)) { | 2280 | if (_can_be_granted(r, lkb, 1)) { |
2240 | grant_lock(r, lkb); | 2281 | grant_lock(r, lkb); |
2241 | queue_cast(r, lkb, 0); | 2282 | queue_cast(r, lkb, 0); |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index dd362739d291..9e9d2e82f40f 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -313,6 +313,7 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port, | |||
313 | in6_addr->sin6_port = cpu_to_be16(port); | 313 | in6_addr->sin6_port = cpu_to_be16(port); |
314 | *addr_len = sizeof(struct sockaddr_in6); | 314 | *addr_len = sizeof(struct sockaddr_in6); |
315 | } | 315 | } |
316 | memset((char *)saddr + *addr_len, 0, sizeof(struct sockaddr_storage) - *addr_len); | ||
316 | } | 317 | } |
317 | 318 | ||
318 | /* Close a remote connection and tidy up */ | 319 | /* Close a remote connection and tidy up */ |
@@ -332,8 +333,19 @@ static void close_connection(struct connection *con, bool and_other) | |||
332 | __free_page(con->rx_page); | 333 | __free_page(con->rx_page); |
333 | con->rx_page = NULL; | 334 | con->rx_page = NULL; |
334 | } | 335 | } |
335 | con->retries = 0; | 336 | |
336 | mutex_unlock(&con->sock_mutex); | 337 | /* If we are an 'othercon' then NULL the pointer to us |
338 | from the parent and tidy ourself up */ | ||
339 | if (test_bit(CF_IS_OTHERCON, &con->flags)) { | ||
340 | struct connection *parent = __nodeid2con(con->nodeid, 0); | ||
341 | parent->othercon = NULL; | ||
342 | kmem_cache_free(con_cache, con); | ||
343 | } | ||
344 | else { | ||
345 | /* Parent connections get reused */ | ||
346 | con->retries = 0; | ||
347 | mutex_unlock(&con->sock_mutex); | ||
348 | } | ||
337 | } | 349 | } |
338 | 350 | ||
339 | /* We only send shutdown messages to nodes that are not part of the cluster */ | 351 | /* We only send shutdown messages to nodes that are not part of the cluster */ |
@@ -631,7 +643,7 @@ out_resched: | |||
631 | 643 | ||
632 | out_close: | 644 | out_close: |
633 | mutex_unlock(&con->sock_mutex); | 645 | mutex_unlock(&con->sock_mutex); |
634 | if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) { | 646 | if (ret != -EAGAIN) { |
635 | close_connection(con, false); | 647 | close_connection(con, false); |
636 | /* Reconnect when there is something to send */ | 648 | /* Reconnect when there is something to send */ |
637 | } | 649 | } |
@@ -1122,8 +1134,6 @@ static int tcp_listen_for_all(void) | |||
1122 | 1134 | ||
1123 | log_print("Using TCP for communications"); | 1135 | log_print("Using TCP for communications"); |
1124 | 1136 | ||
1125 | set_bit(CF_IS_OTHERCON, &con->flags); | ||
1126 | |||
1127 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); | 1137 | sock = tcp_create_listen_sock(con, dlm_local_addr[0]); |
1128 | if (sock) { | 1138 | if (sock) { |
1129 | add_sock(sock, con); | 1139 | add_sock(sock, con); |
@@ -1407,7 +1417,7 @@ void dlm_lowcomms_stop(void) | |||
1407 | for (i = 0; i <= max_nodeid; i++) { | 1417 | for (i = 0; i <= max_nodeid; i++) { |
1408 | con = __nodeid2con(i, 0); | 1418 | con = __nodeid2con(i, 0); |
1409 | if (con) { | 1419 | if (con) { |
1410 | con->flags |= 0xFF; | 1420 | con->flags |= 0x0F; |
1411 | if (con->sock) | 1421 | if (con->sock) |
1412 | con->sock->sk->sk_user_data = NULL; | 1422 | con->sock->sk->sk_user_data = NULL; |
1413 | } | 1423 | } |
@@ -1423,8 +1433,6 @@ void dlm_lowcomms_stop(void) | |||
1423 | con = __nodeid2con(i, 0); | 1433 | con = __nodeid2con(i, 0); |
1424 | if (con) { | 1434 | if (con) { |
1425 | close_connection(con, true); | 1435 | close_connection(con, true); |
1426 | if (con->othercon) | ||
1427 | kmem_cache_free(con_cache, con->othercon); | ||
1428 | kmem_cache_free(con_cache, con); | 1436 | kmem_cache_free(con_cache, con); |
1429 | } | 1437 | } |
1430 | } | 1438 | } |
diff --git a/fs/dlm/member.c b/fs/dlm/member.c index 073599dced2a..d09977528f69 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c | |||
@@ -56,8 +56,10 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid) | |||
56 | return -ENOMEM; | 56 | return -ENOMEM; |
57 | 57 | ||
58 | w = dlm_node_weight(ls->ls_name, nodeid); | 58 | w = dlm_node_weight(ls->ls_name, nodeid); |
59 | if (w < 0) | 59 | if (w < 0) { |
60 | kfree(memb); | ||
60 | return w; | 61 | return w; |
62 | } | ||
61 | 63 | ||
62 | memb->nodeid = nodeid; | 64 | memb->nodeid = nodeid; |
63 | memb->weight = w; | 65 | memb->weight = w; |
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c index e3a1527cbdbe..188b91c027e4 100644 --- a/fs/dlm/rcom.c +++ b/fs/dlm/rcom.c | |||
@@ -386,8 +386,7 @@ static void receive_rcom_lock_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) | |||
386 | dlm_recover_process_copy(ls, rc_in); | 386 | dlm_recover_process_copy(ls, rc_in); |
387 | } | 387 | } |
388 | 388 | ||
389 | static int send_ls_not_ready(struct dlm_ls *ls, int nodeid, | 389 | static int send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in) |
390 | struct dlm_rcom *rc_in) | ||
391 | { | 390 | { |
392 | struct dlm_rcom *rc; | 391 | struct dlm_rcom *rc; |
393 | struct rcom_config *rf; | 392 | struct rcom_config *rf; |
@@ -395,7 +394,7 @@ static int send_ls_not_ready(struct dlm_ls *ls, int nodeid, | |||
395 | char *mb; | 394 | char *mb; |
396 | int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config); | 395 | int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config); |
397 | 396 | ||
398 | mh = dlm_lowcomms_get_buffer(nodeid, mb_len, ls->ls_allocation, &mb); | 397 | mh = dlm_lowcomms_get_buffer(nodeid, mb_len, GFP_NOFS, &mb); |
399 | if (!mh) | 398 | if (!mh) |
400 | return -ENOBUFS; | 399 | return -ENOBUFS; |
401 | memset(mb, 0, mb_len); | 400 | memset(mb, 0, mb_len); |
@@ -465,7 +464,7 @@ void dlm_receive_rcom(struct dlm_header *hd, int nodeid) | |||
465 | log_print("lockspace %x from %d type %x not found", | 464 | log_print("lockspace %x from %d type %x not found", |
466 | hd->h_lockspace, nodeid, rc->rc_type); | 465 | hd->h_lockspace, nodeid, rc->rc_type); |
467 | if (rc->rc_type == DLM_RCOM_STATUS) | 466 | if (rc->rc_type == DLM_RCOM_STATUS) |
468 | send_ls_not_ready(ls, nodeid, rc); | 467 | send_ls_not_ready(nodeid, rc); |
469 | return; | 468 | return; |
470 | } | 469 | } |
471 | 470 | ||
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 0a50942b4378..5d40ad13ab5c 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -353,6 +353,14 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry, | |||
353 | ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n"); | 353 | ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n"); |
354 | goto out; | 354 | goto out; |
355 | } | 355 | } |
356 | if (special_file(lower_inode->i_mode)) { | ||
357 | ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n"); | ||
358 | goto out; | ||
359 | } | ||
360 | if (special_file(lower_inode->i_mode)) { | ||
361 | ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n"); | ||
362 | goto out; | ||
363 | } | ||
356 | if (!nd) { | 364 | if (!nd) { |
357 | ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" | 365 | ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" |
358 | "as we *think* we are about to unlink\n"); | 366 | "as we *think* we are about to unlink\n"); |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index e557a6766927..a98497264fe8 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -813,6 +813,15 @@ out: | |||
813 | return rc; | 813 | return rc; |
814 | } | 814 | } |
815 | 815 | ||
816 | static void do_sysfs_unregistration(void) | ||
817 | { | ||
818 | sysfs_remove_file(&ecryptfs_subsys.kobj, | ||
819 | &sysfs_attr_version.attr); | ||
820 | sysfs_remove_file(&ecryptfs_subsys.kobj, | ||
821 | &sysfs_attr_version_str.attr); | ||
822 | subsystem_unregister(&ecryptfs_subsys); | ||
823 | } | ||
824 | |||
816 | static int __init ecryptfs_init(void) | 825 | static int __init ecryptfs_init(void) |
817 | { | 826 | { |
818 | int rc; | 827 | int rc; |
@@ -851,6 +860,9 @@ static int __init ecryptfs_init(void) | |||
851 | if (rc) { | 860 | if (rc) { |
852 | ecryptfs_printk(KERN_ERR, "Failure occured while attempting to " | 861 | ecryptfs_printk(KERN_ERR, "Failure occured while attempting to " |
853 | "initialize the eCryptfs netlink socket\n"); | 862 | "initialize the eCryptfs netlink socket\n"); |
863 | do_sysfs_unregistration(); | ||
864 | unregister_filesystem(&ecryptfs_fs_type); | ||
865 | ecryptfs_free_kmem_caches(); | ||
854 | } | 866 | } |
855 | out: | 867 | out: |
856 | return rc; | 868 | return rc; |
@@ -858,11 +870,7 @@ out: | |||
858 | 870 | ||
859 | static void __exit ecryptfs_exit(void) | 871 | static void __exit ecryptfs_exit(void) |
860 | { | 872 | { |
861 | sysfs_remove_file(&ecryptfs_subsys.kobj, | 873 | do_sysfs_unregistration(); |
862 | &sysfs_attr_version.attr); | ||
863 | sysfs_remove_file(&ecryptfs_subsys.kobj, | ||
864 | &sysfs_attr_version_str.attr); | ||
865 | subsystem_unregister(&ecryptfs_subsys); | ||
866 | ecryptfs_release_messaging(ecryptfs_transport); | 874 | ecryptfs_release_messaging(ecryptfs_transport); |
867 | unregister_filesystem(&ecryptfs_fs_type); | 875 | unregister_filesystem(&ecryptfs_fs_type); |
868 | ecryptfs_free_kmem_caches(); | 876 | ecryptfs_free_kmem_caches(); |
@@ -780,18 +780,11 @@ static int de_thread(struct task_struct *tsk) | |||
780 | int count; | 780 | int count; |
781 | 781 | ||
782 | /* | 782 | /* |
783 | * Tell all the sighand listeners that this sighand has | ||
784 | * been detached. The signalfd_detach() function grabs the | ||
785 | * sighand lock, if signal listeners are present on the sighand. | ||
786 | */ | ||
787 | signalfd_detach(tsk); | ||
788 | |||
789 | /* | ||
790 | * If we don't share sighandlers, then we aren't sharing anything | 783 | * If we don't share sighandlers, then we aren't sharing anything |
791 | * and we can just re-use it all. | 784 | * and we can just re-use it all. |
792 | */ | 785 | */ |
793 | if (atomic_read(&oldsighand->count) <= 1) { | 786 | if (atomic_read(&oldsighand->count) <= 1) { |
794 | BUG_ON(atomic_read(&sig->count) != 1); | 787 | signalfd_detach(tsk); |
795 | exit_itimers(sig); | 788 | exit_itimers(sig); |
796 | return 0; | 789 | return 0; |
797 | } | 790 | } |
@@ -930,12 +923,11 @@ static int de_thread(struct task_struct *tsk) | |||
930 | sig->flags = 0; | 923 | sig->flags = 0; |
931 | 924 | ||
932 | no_thread_group: | 925 | no_thread_group: |
926 | signalfd_detach(tsk); | ||
933 | exit_itimers(sig); | 927 | exit_itimers(sig); |
934 | if (leader) | 928 | if (leader) |
935 | release_task(leader); | 929 | release_task(leader); |
936 | 930 | ||
937 | BUG_ON(atomic_read(&sig->count) != 1); | ||
938 | |||
939 | if (atomic_read(&oldsighand->count) == 1) { | 931 | if (atomic_read(&oldsighand->count) == 1) { |
940 | /* | 932 | /* |
941 | * Now that we nuked the rest of the thread group, | 933 | * Now that we nuked the rest of the thread group, |
@@ -1084,9 +1076,12 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1084 | */ | 1076 | */ |
1085 | current->mm->task_size = TASK_SIZE; | 1077 | current->mm->task_size = TASK_SIZE; |
1086 | 1078 | ||
1087 | if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || | 1079 | if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) { |
1088 | file_permission(bprm->file, MAY_READ) || | 1080 | suid_keys(current); |
1089 | (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { | 1081 | set_dumpable(current->mm, suid_dumpable); |
1082 | current->pdeath_signal = 0; | ||
1083 | } else if (file_permission(bprm->file, MAY_READ) || | ||
1084 | (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { | ||
1090 | suid_keys(current); | 1085 | suid_keys(current); |
1091 | set_dumpable(current->mm, suid_dumpable); | 1086 | set_dumpable(current->mm, suid_dumpable); |
1092 | } | 1087 | } |
@@ -1177,8 +1172,10 @@ void compute_creds(struct linux_binprm *bprm) | |||
1177 | { | 1172 | { |
1178 | int unsafe; | 1173 | int unsafe; |
1179 | 1174 | ||
1180 | if (bprm->e_uid != current->uid) | 1175 | if (bprm->e_uid != current->uid) { |
1181 | suid_keys(current); | 1176 | suid_keys(current); |
1177 | current->pdeath_signal = 0; | ||
1178 | } | ||
1182 | exec_keys(current); | 1179 | exec_keys(current); |
1183 | 1180 | ||
1184 | task_lock(current); | 1181 | task_lock(current); |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index aff70f0698fd..3b395c41b2f3 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -486,8 +486,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
486 | gfs2_pin(sdp, bd->bd_bh); | 486 | gfs2_pin(sdp, bd->bd_bh); |
487 | tr->tr_num_databuf_new++; | 487 | tr->tr_num_databuf_new++; |
488 | } | 488 | } |
489 | sdp->sd_log_num_databuf++; | ||
490 | gfs2_log_lock(sdp); | 489 | gfs2_log_lock(sdp); |
490 | sdp->sd_log_num_databuf++; | ||
491 | list_add(&le->le_list, &sdp->sd_log_le_databuf); | 491 | list_add(&le->le_list, &sdp->sd_log_le_databuf); |
492 | gfs2_log_unlock(sdp); | 492 | gfs2_log_unlock(sdp); |
493 | } | 493 | } |
@@ -523,7 +523,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
523 | struct buffer_head *bh = NULL,*bh1 = NULL; | 523 | struct buffer_head *bh = NULL,*bh1 = NULL; |
524 | struct gfs2_log_descriptor *ld; | 524 | struct gfs2_log_descriptor *ld; |
525 | unsigned int limit; | 525 | unsigned int limit; |
526 | unsigned int total_dbuf = sdp->sd_log_num_databuf; | 526 | unsigned int total_dbuf; |
527 | unsigned int total_jdata = sdp->sd_log_num_jdata; | 527 | unsigned int total_jdata = sdp->sd_log_num_jdata; |
528 | unsigned int num, n; | 528 | unsigned int num, n; |
529 | __be64 *ptr = NULL; | 529 | __be64 *ptr = NULL; |
@@ -535,6 +535,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
535 | * into the log along with a header | 535 | * into the log along with a header |
536 | */ | 536 | */ |
537 | gfs2_log_lock(sdp); | 537 | gfs2_log_lock(sdp); |
538 | total_dbuf = sdp->sd_log_num_databuf; | ||
538 | bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, | 539 | bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, |
539 | bd_le.le_list); | 540 | bd_le.le_list); |
540 | while(total_dbuf) { | 541 | while(total_dbuf) { |
@@ -653,6 +654,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
653 | break; | 654 | break; |
654 | } | 655 | } |
655 | bh = NULL; | 656 | bh = NULL; |
657 | BUG_ON(total_dbuf < num); | ||
656 | total_dbuf -= num; | 658 | total_dbuf -= num; |
657 | total_jdata -= num; | 659 | total_jdata -= num; |
658 | } | 660 | } |
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c index 6f006a804db3..4864659555d4 100644 --- a/fs/gfs2/mount.c +++ b/fs/gfs2/mount.c | |||
@@ -82,19 +82,20 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount) | |||
82 | char *options, *o, *v; | 82 | char *options, *o, *v; |
83 | int error = 0; | 83 | int error = 0; |
84 | 84 | ||
85 | /* If someone preloaded options, use those instead */ | 85 | if (!remount) { |
86 | spin_lock(&gfs2_sys_margs_lock); | 86 | /* If someone preloaded options, use those instead */ |
87 | if (!remount && gfs2_sys_margs) { | 87 | spin_lock(&gfs2_sys_margs_lock); |
88 | data = gfs2_sys_margs; | 88 | if (gfs2_sys_margs) { |
89 | gfs2_sys_margs = NULL; | 89 | data = gfs2_sys_margs; |
90 | } | 90 | gfs2_sys_margs = NULL; |
91 | spin_unlock(&gfs2_sys_margs_lock); | 91 | } |
92 | spin_unlock(&gfs2_sys_margs_lock); | ||
92 | 93 | ||
93 | /* Set some defaults */ | 94 | /* Set some defaults */ |
94 | memset(args, 0, sizeof(struct gfs2_args)); | 95 | args->ar_num_glockd = GFS2_GLOCKD_DEFAULT; |
95 | args->ar_num_glockd = GFS2_GLOCKD_DEFAULT; | 96 | args->ar_quota = GFS2_QUOTA_DEFAULT; |
96 | args->ar_quota = GFS2_QUOTA_DEFAULT; | 97 | args->ar_data = GFS2_DATA_DEFAULT; |
97 | args->ar_data = GFS2_DATA_DEFAULT; | 98 | } |
98 | 99 | ||
99 | /* Split the options into tokens with the "," character and | 100 | /* Split the options into tokens with the "," character and |
100 | process them */ | 101 | process them */ |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index ce90032c010e..42a5f58f6fca 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page, | |||
416 | 416 | ||
417 | error = gfs2_trans_begin(sdp, rblocks, 0); | 417 | error = gfs2_trans_begin(sdp, rblocks, 0); |
418 | if (error) | 418 | if (error) |
419 | goto out; | 419 | goto out_trans_fail; |
420 | 420 | ||
421 | if (gfs2_is_stuffed(ip)) { | 421 | if (gfs2_is_stuffed(ip)) { |
422 | if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { | 422 | if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { |
@@ -434,6 +434,7 @@ prepare_write: | |||
434 | out: | 434 | out: |
435 | if (error) { | 435 | if (error) { |
436 | gfs2_trans_end(sdp); | 436 | gfs2_trans_end(sdp); |
437 | out_trans_fail: | ||
437 | if (alloc_required) { | 438 | if (alloc_required) { |
438 | gfs2_inplace_release(ip); | 439 | gfs2_inplace_release(ip); |
439 | out_qunlock: | 440 | out_qunlock: |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 773421130116..94d76ace0b95 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -177,8 +177,8 @@ static const u32 fsflags_to_gfs2[32] = { | |||
177 | [5] = GFS2_DIF_APPENDONLY, | 177 | [5] = GFS2_DIF_APPENDONLY, |
178 | [7] = GFS2_DIF_NOATIME, | 178 | [7] = GFS2_DIF_NOATIME, |
179 | [12] = GFS2_DIF_EXHASH, | 179 | [12] = GFS2_DIF_EXHASH, |
180 | [14] = GFS2_DIF_JDATA, | 180 | [14] = GFS2_DIF_INHERIT_JDATA, |
181 | [20] = GFS2_DIF_DIRECTIO, | 181 | [20] = GFS2_DIF_INHERIT_DIRECTIO, |
182 | }; | 182 | }; |
183 | 183 | ||
184 | static const u32 gfs2_to_fsflags[32] = { | 184 | static const u32 gfs2_to_fsflags[32] = { |
@@ -187,8 +187,6 @@ static const u32 gfs2_to_fsflags[32] = { | |||
187 | [gfs2fl_AppendOnly] = FS_APPEND_FL, | 187 | [gfs2fl_AppendOnly] = FS_APPEND_FL, |
188 | [gfs2fl_NoAtime] = FS_NOATIME_FL, | 188 | [gfs2fl_NoAtime] = FS_NOATIME_FL, |
189 | [gfs2fl_ExHash] = FS_INDEX_FL, | 189 | [gfs2fl_ExHash] = FS_INDEX_FL, |
190 | [gfs2fl_Jdata] = FS_JOURNAL_DATA_FL, | ||
191 | [gfs2fl_Directio] = FS_DIRECTIO_FL, | ||
192 | [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL, | 190 | [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL, |
193 | [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, | 191 | [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, |
194 | }; | 192 | }; |
@@ -207,6 +205,12 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | |||
207 | return error; | 205 | return error; |
208 | 206 | ||
209 | fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); | 207 | fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); |
208 | if (!S_ISDIR(inode->i_mode)) { | ||
209 | if (ip->i_di.di_flags & GFS2_DIF_JDATA) | ||
210 | fsflags |= FS_JOURNAL_DATA_FL; | ||
211 | if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO) | ||
212 | fsflags |= FS_DIRECTIO_FL; | ||
213 | } | ||
210 | if (put_user(fsflags, ptr)) | 214 | if (put_user(fsflags, ptr)) |
211 | error = -EFAULT; | 215 | error = -EFAULT; |
212 | 216 | ||
@@ -270,13 +274,6 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | |||
270 | if ((new_flags ^ flags) == 0) | 274 | if ((new_flags ^ flags) == 0) |
271 | goto out; | 275 | goto out; |
272 | 276 | ||
273 | if (S_ISDIR(inode->i_mode)) { | ||
274 | if ((new_flags ^ flags) & GFS2_DIF_JDATA) | ||
275 | new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA); | ||
276 | if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO) | ||
277 | new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO); | ||
278 | } | ||
279 | |||
280 | error = -EINVAL; | 277 | error = -EINVAL; |
281 | if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) | 278 | if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) |
282 | goto out; | 279 | goto out; |
@@ -315,11 +312,19 @@ out: | |||
315 | 312 | ||
316 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | 313 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
317 | { | 314 | { |
315 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
318 | u32 fsflags, gfsflags; | 316 | u32 fsflags, gfsflags; |
319 | if (get_user(fsflags, ptr)) | 317 | if (get_user(fsflags, ptr)) |
320 | return -EFAULT; | 318 | return -EFAULT; |
321 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); | 319 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); |
322 | return do_gfs2_set_flags(filp, gfsflags, ~0); | 320 | if (!S_ISDIR(inode->i_mode)) { |
321 | if (gfsflags & GFS2_DIF_INHERIT_JDATA) | ||
322 | gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA); | ||
323 | if (gfsflags & GFS2_DIF_INHERIT_DIRECTIO) | ||
324 | gfsflags ^= (GFS2_DIF_DIRECTIO | GFS2_DIF_INHERIT_DIRECTIO); | ||
325 | return do_gfs2_set_flags(filp, gfsflags, ~0); | ||
326 | } | ||
327 | return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA); | ||
323 | } | 328 | } |
324 | 329 | ||
325 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 330 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index e4e040625153..ce48c4594ec8 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -863,16 +863,19 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked) | |||
863 | u64 no_addr; | 863 | u64 no_addr; |
864 | 864 | ||
865 | for(;;) { | 865 | for(;;) { |
866 | if (goal >= rgd->rd_data) | ||
867 | break; | ||
866 | goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, | 868 | goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED, |
867 | GFS2_BLKST_UNLINKED); | 869 | GFS2_BLKST_UNLINKED); |
868 | if (goal == 0) | 870 | if (goal == BFITNOENT) |
869 | return 0; | 871 | break; |
870 | no_addr = goal + rgd->rd_data0; | 872 | no_addr = goal + rgd->rd_data0; |
871 | if (no_addr <= *last_unlinked) | 873 | goal++; |
874 | if (no_addr < *last_unlinked) | ||
872 | continue; | 875 | continue; |
873 | *last_unlinked = no_addr; | 876 | *last_unlinked = no_addr; |
874 | inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN, | 877 | inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN, |
875 | no_addr, -1); | 878 | no_addr, -1); |
876 | if (!IS_ERR(inode)) | 879 | if (!IS_ERR(inode)) |
877 | return inode; | 880 | return inode; |
878 | } | 881 | } |
@@ -1313,7 +1316,7 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal, | |||
1313 | bi->bi_len, blk, new_state); | 1316 | bi->bi_len, blk, new_state); |
1314 | } | 1317 | } |
1315 | 1318 | ||
1316 | return (blk == BFITNOENT) ? 0 : (bi->bi_start * GFS2_NBBY) + blk; | 1319 | return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk; |
1317 | } | 1320 | } |
1318 | 1321 | ||
1319 | /** | 1322 | /** |
@@ -1393,6 +1396,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1393 | goal = rgd->rd_last_alloc_data; | 1396 | goal = rgd->rd_last_alloc_data; |
1394 | 1397 | ||
1395 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); | 1398 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); |
1399 | BUG_ON(blk == BFITNOENT); | ||
1396 | rgd->rd_last_alloc_data = blk; | 1400 | rgd->rd_last_alloc_data = blk; |
1397 | 1401 | ||
1398 | block = rgd->rd_data0 + blk; | 1402 | block = rgd->rd_data0 + blk; |
@@ -1437,6 +1441,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1437 | goal = rgd->rd_last_alloc_meta; | 1441 | goal = rgd->rd_last_alloc_meta; |
1438 | 1442 | ||
1439 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); | 1443 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); |
1444 | BUG_ON(blk == BFITNOENT); | ||
1440 | rgd->rd_last_alloc_meta = blk; | 1445 | rgd->rd_last_alloc_meta = blk; |
1441 | 1446 | ||
1442 | block = rgd->rd_data0 + blk; | 1447 | block = rgd->rd_data0 + blk; |
@@ -1478,6 +1483,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | |||
1478 | 1483 | ||
1479 | blk = rgblk_search(rgd, rgd->rd_last_alloc_meta, | 1484 | blk = rgblk_search(rgd, rgd->rd_last_alloc_meta, |
1480 | GFS2_BLKST_FREE, GFS2_BLKST_DINODE); | 1485 | GFS2_BLKST_FREE, GFS2_BLKST_DINODE); |
1486 | BUG_ON(blk == BFITNOENT); | ||
1481 | 1487 | ||
1482 | rgd->rd_last_alloc_meta = blk; | 1488 | rgd->rd_last_alloc_meta = blk; |
1483 | 1489 | ||
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index bc6185933664..664c164aa67c 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -566,6 +566,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
566 | struct jffs2_full_dirent **prev = &dir_f->dents; | 566 | struct jffs2_full_dirent **prev = &dir_f->dents; |
567 | uint32_t nhash = full_name_hash(name, namelen); | 567 | uint32_t nhash = full_name_hash(name, namelen); |
568 | 568 | ||
569 | /* We don't actually want to reserve any space, but we do | ||
570 | want to be holding the alloc_sem when we write to flash */ | ||
571 | down(&c->alloc_sem); | ||
569 | down(&dir_f->sem); | 572 | down(&dir_f->sem); |
570 | 573 | ||
571 | while ((*prev) && (*prev)->nhash <= nhash) { | 574 | while ((*prev) && (*prev)->nhash <= nhash) { |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 20ac403469a0..c55a761c22bb 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -20,10 +20,8 @@ | |||
20 | #include "delegation.h" | 20 | #include "delegation.h" |
21 | #include "internal.h" | 21 | #include "internal.h" |
22 | 22 | ||
23 | static void nfs_free_delegation(struct nfs_delegation *delegation) | 23 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) |
24 | { | 24 | { |
25 | if (delegation->cred) | ||
26 | put_rpccred(delegation->cred); | ||
27 | kfree(delegation); | 25 | kfree(delegation); |
28 | } | 26 | } |
29 | 27 | ||
@@ -31,7 +29,18 @@ static void nfs_free_delegation_callback(struct rcu_head *head) | |||
31 | { | 29 | { |
32 | struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu); | 30 | struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu); |
33 | 31 | ||
34 | nfs_free_delegation(delegation); | 32 | nfs_do_free_delegation(delegation); |
33 | } | ||
34 | |||
35 | static void nfs_free_delegation(struct nfs_delegation *delegation) | ||
36 | { | ||
37 | struct rpc_cred *cred; | ||
38 | |||
39 | cred = rcu_dereference(delegation->cred); | ||
40 | rcu_assign_pointer(delegation->cred, NULL); | ||
41 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | ||
42 | if (cred) | ||
43 | put_rpccred(cred); | ||
35 | } | 44 | } |
36 | 45 | ||
37 | static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state) | 46 | static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state) |
@@ -166,7 +175,7 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation * | |||
166 | int res = 0; | 175 | int res = 0; |
167 | 176 | ||
168 | res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid); | 177 | res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid); |
169 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | 178 | nfs_free_delegation(delegation); |
170 | return res; | 179 | return res; |
171 | } | 180 | } |
172 | 181 | ||
@@ -448,7 +457,7 @@ restart: | |||
448 | spin_unlock(&clp->cl_lock); | 457 | spin_unlock(&clp->cl_lock); |
449 | rcu_read_unlock(); | 458 | rcu_read_unlock(); |
450 | if (delegation != NULL) | 459 | if (delegation != NULL) |
451 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | 460 | nfs_free_delegation(delegation); |
452 | goto restart; | 461 | goto restart; |
453 | } | 462 | } |
454 | rcu_read_unlock(); | 463 | rcu_read_unlock(); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bca6cdcb9f0d..71a49c3acabd 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -468,7 +468,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str | |||
468 | ctx->lockowner = current->files; | 468 | ctx->lockowner = current->files; |
469 | ctx->error = 0; | 469 | ctx->error = 0; |
470 | ctx->dir_cookie = 0; | 470 | ctx->dir_cookie = 0; |
471 | kref_init(&ctx->kref); | 471 | atomic_set(&ctx->count, 1); |
472 | } | 472 | } |
473 | return ctx; | 473 | return ctx; |
474 | } | 474 | } |
@@ -476,21 +476,18 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str | |||
476 | struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) | 476 | struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) |
477 | { | 477 | { |
478 | if (ctx != NULL) | 478 | if (ctx != NULL) |
479 | kref_get(&ctx->kref); | 479 | atomic_inc(&ctx->count); |
480 | return ctx; | 480 | return ctx; |
481 | } | 481 | } |
482 | 482 | ||
483 | static void nfs_free_open_context(struct kref *kref) | 483 | void put_nfs_open_context(struct nfs_open_context *ctx) |
484 | { | 484 | { |
485 | struct nfs_open_context *ctx = container_of(kref, | 485 | struct inode *inode = ctx->path.dentry->d_inode; |
486 | struct nfs_open_context, kref); | ||
487 | 486 | ||
488 | if (!list_empty(&ctx->list)) { | 487 | if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock)) |
489 | struct inode *inode = ctx->path.dentry->d_inode; | 488 | return; |
490 | spin_lock(&inode->i_lock); | 489 | list_del(&ctx->list); |
491 | list_del(&ctx->list); | 490 | spin_unlock(&inode->i_lock); |
492 | spin_unlock(&inode->i_lock); | ||
493 | } | ||
494 | if (ctx->state != NULL) | 491 | if (ctx->state != NULL) |
495 | nfs4_close_state(&ctx->path, ctx->state, ctx->mode); | 492 | nfs4_close_state(&ctx->path, ctx->state, ctx->mode); |
496 | if (ctx->cred != NULL) | 493 | if (ctx->cred != NULL) |
@@ -500,11 +497,6 @@ static void nfs_free_open_context(struct kref *kref) | |||
500 | kfree(ctx); | 497 | kfree(ctx); |
501 | } | 498 | } |
502 | 499 | ||
503 | void put_nfs_open_context(struct nfs_open_context *ctx) | ||
504 | { | ||
505 | kref_put(&ctx->kref, nfs_free_open_context); | ||
506 | } | ||
507 | |||
508 | /* | 500 | /* |
509 | * Ensure that mmap has a recent RPC credential for use when writing out | 501 | * Ensure that mmap has a recent RPC credential for use when writing out |
510 | * shared pages | 502 | * shared pages |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 7f86e65182e4..aea76d0e5fbd 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -175,10 +175,8 @@ static void nfs_expire_automounts(struct work_struct *work) | |||
175 | 175 | ||
176 | void nfs_release_automount_timer(void) | 176 | void nfs_release_automount_timer(void) |
177 | { | 177 | { |
178 | if (list_empty(&nfs_automount_list)) { | 178 | if (list_empty(&nfs_automount_list)) |
179 | cancel_delayed_work(&nfs_automount_task); | 179 | cancel_delayed_work_sync(&nfs_automount_task); |
180 | flush_scheduled_work(); | ||
181 | } | ||
182 | } | 180 | } |
183 | 181 | ||
184 | /* | 182 | /* |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6ca2795ccd9c..62b3ae280310 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -332,11 +332,9 @@ static int can_open_cached(struct nfs4_state *state, int mode) | |||
332 | switch (mode & (FMODE_READ|FMODE_WRITE|O_EXCL)) { | 332 | switch (mode & (FMODE_READ|FMODE_WRITE|O_EXCL)) { |
333 | case FMODE_READ: | 333 | case FMODE_READ: |
334 | ret |= test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0; | 334 | ret |= test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0; |
335 | ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0; | ||
336 | break; | 335 | break; |
337 | case FMODE_WRITE: | 336 | case FMODE_WRITE: |
338 | ret |= test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0; | 337 | ret |= test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0; |
339 | ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0; | ||
340 | break; | 338 | break; |
341 | case FMODE_READ|FMODE_WRITE: | 339 | case FMODE_READ|FMODE_WRITE: |
342 | ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0; | 340 | ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0; |
@@ -1260,7 +1258,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
1260 | nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid); | 1258 | nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid); |
1261 | switch (task->tk_status) { | 1259 | switch (task->tk_status) { |
1262 | case 0: | 1260 | case 0: |
1263 | nfs_set_open_stateid(state, &calldata->res.stateid, calldata->arg.open_flags); | 1261 | nfs_set_open_stateid(state, &calldata->res.stateid, 0); |
1264 | renew_lease(server, calldata->timestamp); | 1262 | renew_lease(server, calldata->timestamp); |
1265 | break; | 1263 | break; |
1266 | case -NFS4ERR_STALE_STATEID: | 1264 | case -NFS4ERR_STALE_STATEID: |
@@ -1286,23 +1284,19 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
1286 | .rpc_cred = state->owner->so_cred, | 1284 | .rpc_cred = state->owner->so_cred, |
1287 | }; | 1285 | }; |
1288 | int clear_rd, clear_wr, clear_rdwr; | 1286 | int clear_rd, clear_wr, clear_rdwr; |
1289 | int mode; | ||
1290 | 1287 | ||
1291 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) | 1288 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) |
1292 | return; | 1289 | return; |
1293 | 1290 | ||
1294 | mode = FMODE_READ|FMODE_WRITE; | ||
1295 | clear_rd = clear_wr = clear_rdwr = 0; | 1291 | clear_rd = clear_wr = clear_rdwr = 0; |
1296 | spin_lock(&state->owner->so_lock); | 1292 | spin_lock(&state->owner->so_lock); |
1297 | /* Calculate the change in open mode */ | 1293 | /* Calculate the change in open mode */ |
1298 | if (state->n_rdwr == 0) { | 1294 | if (state->n_rdwr == 0) { |
1299 | if (state->n_rdonly == 0) { | 1295 | if (state->n_rdonly == 0) { |
1300 | mode &= ~FMODE_READ; | ||
1301 | clear_rd |= test_and_clear_bit(NFS_O_RDONLY_STATE, &state->flags); | 1296 | clear_rd |= test_and_clear_bit(NFS_O_RDONLY_STATE, &state->flags); |
1302 | clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); | 1297 | clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); |
1303 | } | 1298 | } |
1304 | if (state->n_wronly == 0) { | 1299 | if (state->n_wronly == 0) { |
1305 | mode &= ~FMODE_WRITE; | ||
1306 | clear_wr |= test_and_clear_bit(NFS_O_WRONLY_STATE, &state->flags); | 1300 | clear_wr |= test_and_clear_bit(NFS_O_WRONLY_STATE, &state->flags); |
1307 | clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); | 1301 | clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags); |
1308 | } | 1302 | } |
@@ -1314,9 +1308,13 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
1314 | return; | 1308 | return; |
1315 | } | 1309 | } |
1316 | nfs_fattr_init(calldata->res.fattr); | 1310 | nfs_fattr_init(calldata->res.fattr); |
1317 | if (mode != 0) | 1311 | if (test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0) { |
1318 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | 1312 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
1319 | calldata->arg.open_flags = mode; | 1313 | calldata->arg.open_flags = FMODE_READ; |
1314 | } else if (test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0) { | ||
1315 | msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; | ||
1316 | calldata->arg.open_flags = FMODE_WRITE; | ||
1317 | } | ||
1320 | calldata->timestamp = jiffies; | 1318 | calldata->timestamp = jiffies; |
1321 | rpc_call_setup(task, &msg, 0); | 1319 | rpc_call_setup(task, &msg, 0); |
1322 | } | 1320 | } |
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 0505ca124034..3ea352d82eba 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -127,16 +127,15 @@ nfs4_schedule_state_renewal(struct nfs_client *clp) | |||
127 | void | 127 | void |
128 | nfs4_renewd_prepare_shutdown(struct nfs_server *server) | 128 | nfs4_renewd_prepare_shutdown(struct nfs_server *server) |
129 | { | 129 | { |
130 | flush_scheduled_work(); | 130 | cancel_delayed_work(&server->nfs_client->cl_renewd); |
131 | } | 131 | } |
132 | 132 | ||
133 | void | 133 | void |
134 | nfs4_kill_renewd(struct nfs_client *clp) | 134 | nfs4_kill_renewd(struct nfs_client *clp) |
135 | { | 135 | { |
136 | down_read(&clp->cl_sem); | 136 | down_read(&clp->cl_sem); |
137 | cancel_delayed_work(&clp->cl_renewd); | 137 | cancel_delayed_work_sync(&clp->cl_renewd); |
138 | up_read(&clp->cl_sem); | 138 | up_read(&clp->cl_sem); |
139 | flush_scheduled_work(); | ||
140 | } | 139 | } |
141 | 140 | ||
142 | /* | 141 | /* |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e9662ba81d86..3e4adf8c8312 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -341,8 +341,6 @@ nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode) | |||
341 | else | 341 | else |
342 | list_move_tail(&state->open_states, &state->owner->so_states); | 342 | list_move_tail(&state->open_states, &state->owner->so_states); |
343 | } | 343 | } |
344 | if (mode == 0) | ||
345 | list_del_init(&state->inode_states); | ||
346 | state->state = mode; | 344 | state->state = mode; |
347 | } | 345 | } |
348 | 346 | ||
@@ -415,8 +413,7 @@ void nfs4_put_open_state(struct nfs4_state *state) | |||
415 | if (!atomic_dec_and_lock(&state->count, &owner->so_lock)) | 413 | if (!atomic_dec_and_lock(&state->count, &owner->so_lock)) |
416 | return; | 414 | return; |
417 | spin_lock(&inode->i_lock); | 415 | spin_lock(&inode->i_lock); |
418 | if (!list_empty(&state->inode_states)) | 416 | list_del(&state->inode_states); |
419 | list_del(&state->inode_states); | ||
420 | list_del(&state->open_states); | 417 | list_del(&state->open_states); |
421 | spin_unlock(&inode->i_lock); | 418 | spin_unlock(&inode->i_lock); |
422 | spin_unlock(&owner->so_lock); | 419 | spin_unlock(&owner->so_lock); |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index f5e11f4fa952..4f517665c9a0 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -3731,7 +3731,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, | |||
3731 | { | 3731 | { |
3732 | int status; | 3732 | int status; |
3733 | struct buffer_head *last_eb_bh = NULL; | 3733 | struct buffer_head *last_eb_bh = NULL; |
3734 | struct buffer_head *bh = NULL; | ||
3735 | struct ocfs2_insert_type insert = {0, }; | 3734 | struct ocfs2_insert_type insert = {0, }; |
3736 | struct ocfs2_extent_rec rec; | 3735 | struct ocfs2_extent_rec rec; |
3737 | 3736 | ||
@@ -3783,9 +3782,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, | |||
3783 | ocfs2_extent_map_insert_rec(inode, &rec); | 3782 | ocfs2_extent_map_insert_rec(inode, &rec); |
3784 | 3783 | ||
3785 | bail: | 3784 | bail: |
3786 | if (bh) | ||
3787 | brelse(bh); | ||
3788 | |||
3789 | if (last_eb_bh) | 3785 | if (last_eb_bh) |
3790 | brelse(last_eb_bh); | 3786 | brelse(last_eb_bh); |
3791 | 3787 | ||
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index f0bdfd944c44..685c18065c82 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -854,17 +854,25 @@ static void o2net_sendpage(struct o2net_sock_container *sc, | |||
854 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | 854 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); |
855 | ssize_t ret; | 855 | ssize_t ret; |
856 | 856 | ||
857 | 857 | while (1) { | |
858 | mutex_lock(&sc->sc_send_lock); | 858 | mutex_lock(&sc->sc_send_lock); |
859 | ret = sc->sc_sock->ops->sendpage(sc->sc_sock, | 859 | ret = sc->sc_sock->ops->sendpage(sc->sc_sock, |
860 | virt_to_page(kmalloced_virt), | 860 | virt_to_page(kmalloced_virt), |
861 | (long)kmalloced_virt & ~PAGE_MASK, | 861 | (long)kmalloced_virt & ~PAGE_MASK, |
862 | size, MSG_DONTWAIT); | 862 | size, MSG_DONTWAIT); |
863 | mutex_unlock(&sc->sc_send_lock); | 863 | mutex_unlock(&sc->sc_send_lock); |
864 | if (ret != size) { | 864 | if (ret == size) |
865 | break; | ||
866 | if (ret == (ssize_t)-EAGAIN) { | ||
867 | mlog(0, "sendpage of size %zu to " SC_NODEF_FMT | ||
868 | " returned EAGAIN\n", size, SC_NODEF_ARGS(sc)); | ||
869 | cond_resched(); | ||
870 | continue; | ||
871 | } | ||
865 | mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT | 872 | mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT |
866 | " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); | 873 | " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); |
867 | o2net_ensure_shutdown(nn, sc, 0); | 874 | o2net_ensure_shutdown(nn, sc, 0); |
875 | break; | ||
868 | } | 876 | } |
869 | } | 877 | } |
870 | 878 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index c4034f693e7b..4ffa715be09c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -187,6 +187,7 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
187 | int ret; | 187 | int ret; |
188 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 188 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
189 | handle_t *handle; | 189 | handle_t *handle; |
190 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; | ||
190 | 191 | ||
191 | mlog_entry_void(); | 192 | mlog_entry_void(); |
192 | 193 | ||
@@ -197,11 +198,27 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
197 | goto out; | 198 | goto out; |
198 | } | 199 | } |
199 | 200 | ||
201 | ret = ocfs2_journal_access(handle, inode, bh, | ||
202 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
203 | if (ret) { | ||
204 | mlog_errno(ret); | ||
205 | goto out_commit; | ||
206 | } | ||
207 | |||
208 | /* | ||
209 | * Don't use ocfs2_mark_inode_dirty() here as we don't always | ||
210 | * have i_mutex to guard against concurrent changes to other | ||
211 | * inode fields. | ||
212 | */ | ||
200 | inode->i_atime = CURRENT_TIME; | 213 | inode->i_atime = CURRENT_TIME; |
201 | ret = ocfs2_mark_inode_dirty(handle, inode, bh); | 214 | di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); |
215 | di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); | ||
216 | |||
217 | ret = ocfs2_journal_dirty(handle, bh); | ||
202 | if (ret < 0) | 218 | if (ret < 0) |
203 | mlog_errno(ret); | 219 | mlog_errno(ret); |
204 | 220 | ||
221 | out_commit: | ||
205 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | 222 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); |
206 | out: | 223 | out: |
207 | mlog_exit(ret); | 224 | mlog_exit(ret); |
@@ -1011,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1011 | } | 1028 | } |
1012 | 1029 | ||
1013 | if (size_change && attr->ia_size != i_size_read(inode)) { | 1030 | if (size_change && attr->ia_size != i_size_read(inode)) { |
1031 | if (attr->ia_size > sb->s_maxbytes) { | ||
1032 | status = -EFBIG; | ||
1033 | goto bail_unlock; | ||
1034 | } | ||
1035 | |||
1014 | if (i_size_read(inode) > attr->ia_size) | 1036 | if (i_size_read(inode) > attr->ia_size) |
1015 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); | 1037 | status = ocfs2_truncate_file(inode, bh, attr->ia_size); |
1016 | else | 1038 | else |
@@ -1516,7 +1538,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, | |||
1516 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1538 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1517 | struct buffer_head *di_bh = NULL; | 1539 | struct buffer_head *di_bh = NULL; |
1518 | handle_t *handle; | 1540 | handle_t *handle; |
1519 | unsigned long long max_off = ocfs2_max_file_offset(inode->i_sb->s_blocksize_bits); | 1541 | unsigned long long max_off = inode->i_sb->s_maxbytes; |
1520 | 1542 | ||
1521 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 1543 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
1522 | return -EROFS; | 1544 | return -EROFS; |
@@ -1942,7 +1964,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos, | |||
1942 | } | 1964 | } |
1943 | 1965 | ||
1944 | dst = kmap_atomic(page, KM_USER0); | 1966 | dst = kmap_atomic(page, KM_USER0); |
1945 | memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes); | 1967 | memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes); |
1946 | kunmap_atomic(dst, KM_USER0); | 1968 | kunmap_atomic(dst, KM_USER0); |
1947 | flush_dcache_page(page); | 1969 | flush_dcache_page(page); |
1948 | ocfs2_put_write_source(user_page); | 1970 | ocfs2_put_write_source(user_page); |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index d430fdab16e9..701e6d04ed5d 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -1080,6 +1080,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1080 | struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir, | 1080 | struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir, |
1081 | // this is the 1st dirent bh | 1081 | // this is the 1st dirent bh |
1082 | nlink_t old_dir_nlink = old_dir->i_nlink; | 1082 | nlink_t old_dir_nlink = old_dir->i_nlink; |
1083 | struct ocfs2_dinode *old_di; | ||
1083 | 1084 | ||
1084 | /* At some point it might be nice to break this function up a | 1085 | /* At some point it might be nice to break this function up a |
1085 | * bit. */ | 1086 | * bit. */ |
@@ -1354,7 +1355,20 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1354 | 1355 | ||
1355 | old_inode->i_ctime = CURRENT_TIME; | 1356 | old_inode->i_ctime = CURRENT_TIME; |
1356 | mark_inode_dirty(old_inode); | 1357 | mark_inode_dirty(old_inode); |
1357 | ocfs2_mark_inode_dirty(handle, old_inode, old_inode_bh); | 1358 | |
1359 | status = ocfs2_journal_access(handle, old_inode, old_inode_bh, | ||
1360 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
1361 | if (status >= 0) { | ||
1362 | old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; | ||
1363 | |||
1364 | old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec); | ||
1365 | old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec); | ||
1366 | |||
1367 | status = ocfs2_journal_dirty(handle, old_inode_bh); | ||
1368 | if (status < 0) | ||
1369 | mlog_errno(status); | ||
1370 | } else | ||
1371 | mlog_errno(status); | ||
1358 | 1372 | ||
1359 | /* now that the name has been added to new_dir, remove the old name */ | 1373 | /* now that the name has been added to new_dir, remove the old name */ |
1360 | status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh); | 1374 | status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh); |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 5cc90a40b3c5..58307853fb4a 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -494,16 +494,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb, | |||
494 | /* | 494 | /* |
495 | * Find the 1st page index which covers the given clusters. | 495 | * Find the 1st page index which covers the given clusters. |
496 | */ | 496 | */ |
497 | static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, | 497 | static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb, |
498 | u32 clusters) | 498 | u32 clusters) |
499 | { | 499 | { |
500 | unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; | 500 | unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; |
501 | unsigned long index = clusters; | 501 | pgoff_t index = clusters; |
502 | 502 | ||
503 | if (PAGE_CACHE_SHIFT > cbits) { | 503 | if (PAGE_CACHE_SHIFT > cbits) { |
504 | index = clusters >> (PAGE_CACHE_SHIFT - cbits); | 504 | index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits); |
505 | } else if (PAGE_CACHE_SHIFT < cbits) { | 505 | } else if (PAGE_CACHE_SHIFT < cbits) { |
506 | index = clusters << (cbits - PAGE_CACHE_SHIFT); | 506 | index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT); |
507 | } | 507 | } |
508 | 508 | ||
509 | return index; | 509 | return index; |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 200c7d4790dc..f2fc9a795deb 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -316,39 +316,51 @@ static void ocfs2_destroy_inode(struct inode *inode) | |||
316 | kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); | 316 | kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); |
317 | } | 317 | } |
318 | 318 | ||
319 | /* From xfs_super.c:xfs_max_file_offset | 319 | static unsigned long long ocfs2_max_file_offset(unsigned int bbits, |
320 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. | 320 | unsigned int cbits) |
321 | */ | ||
322 | unsigned long long ocfs2_max_file_offset(unsigned int blockshift) | ||
323 | { | 321 | { |
324 | unsigned int pagefactor = 1; | 322 | unsigned int bytes = 1 << cbits; |
325 | unsigned int bitshift = BITS_PER_LONG - 1; | 323 | unsigned int trim = bytes; |
326 | 324 | unsigned int bitshift = 32; | |
327 | /* Figure out maximum filesize, on Linux this can depend on | 325 | |
328 | * the filesystem blocksize (on 32 bit platforms). | 326 | /* |
329 | * __block_prepare_write does this in an [unsigned] long... | 327 | * i_size and all block offsets in ocfs2 are always 64 bits |
330 | * page->index << (PAGE_CACHE_SHIFT - bbits) | 328 | * wide. i_clusters is 32 bits, in cluster-sized units. So on |
331 | * So, for page sized blocks (4K on 32 bit platforms), | 329 | * 64 bit platforms, cluster size will be the limiting factor. |
332 | * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is | ||
333 | * (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) | ||
334 | * but for smaller blocksizes it is less (bbits = log2 bsize). | ||
335 | * Note1: get_block_t takes a long (implicit cast from above) | ||
336 | * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch | ||
337 | * can optionally convert the [unsigned] long from above into | ||
338 | * an [unsigned] long long. | ||
339 | */ | 330 | */ |
340 | 331 | ||
341 | #if BITS_PER_LONG == 32 | 332 | #if BITS_PER_LONG == 32 |
342 | # if defined(CONFIG_LBD) | 333 | # if defined(CONFIG_LBD) |
343 | BUILD_BUG_ON(sizeof(sector_t) != 8); | 334 | BUILD_BUG_ON(sizeof(sector_t) != 8); |
344 | pagefactor = PAGE_CACHE_SIZE; | 335 | /* |
345 | bitshift = BITS_PER_LONG; | 336 | * We might be limited by page cache size. |
337 | */ | ||
338 | if (bytes > PAGE_CACHE_SIZE) { | ||
339 | bytes = PAGE_CACHE_SIZE; | ||
340 | trim = 1; | ||
341 | /* | ||
342 | * Shift by 31 here so that we don't get larger than | ||
343 | * MAX_LFS_FILESIZE | ||
344 | */ | ||
345 | bitshift = 31; | ||
346 | } | ||
346 | # else | 347 | # else |
347 | pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift); | 348 | /* |
349 | * We are limited by the size of sector_t. Use block size, as | ||
350 | * that's what we expose to the VFS. | ||
351 | */ | ||
352 | bytes = 1 << bbits; | ||
353 | trim = 1; | ||
354 | bitshift = 31; | ||
348 | # endif | 355 | # endif |
349 | #endif | 356 | #endif |
350 | 357 | ||
351 | return (((unsigned long long)pagefactor) << bitshift) - 1; | 358 | /* |
359 | * Trim by a whole cluster when we can actually approach the | ||
360 | * on-disk limits. Otherwise we can overflow i_clusters when | ||
361 | * an extent start is at the max offset. | ||
362 | */ | ||
363 | return (((unsigned long long)bytes) << bitshift) - trim; | ||
352 | } | 364 | } |
353 | 365 | ||
354 | static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | 366 | static int ocfs2_remount(struct super_block *sb, int *flags, char *data) |
@@ -1259,8 +1271,8 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1259 | int sector_size) | 1271 | int sector_size) |
1260 | { | 1272 | { |
1261 | int status = 0; | 1273 | int status = 0; |
1262 | int i; | 1274 | int i, cbits, bbits; |
1263 | struct ocfs2_dinode *di = NULL; | 1275 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; |
1264 | struct inode *inode = NULL; | 1276 | struct inode *inode = NULL; |
1265 | struct buffer_head *bitmap_bh = NULL; | 1277 | struct buffer_head *bitmap_bh = NULL; |
1266 | struct ocfs2_journal *journal; | 1278 | struct ocfs2_journal *journal; |
@@ -1279,9 +1291,12 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1279 | sb->s_fs_info = osb; | 1291 | sb->s_fs_info = osb; |
1280 | sb->s_op = &ocfs2_sops; | 1292 | sb->s_op = &ocfs2_sops; |
1281 | sb->s_export_op = &ocfs2_export_ops; | 1293 | sb->s_export_op = &ocfs2_export_ops; |
1294 | sb->s_time_gran = 1; | ||
1282 | sb->s_flags |= MS_NOATIME; | 1295 | sb->s_flags |= MS_NOATIME; |
1283 | /* this is needed to support O_LARGEFILE */ | 1296 | /* this is needed to support O_LARGEFILE */ |
1284 | sb->s_maxbytes = ocfs2_max_file_offset(sb->s_blocksize_bits); | 1297 | cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); |
1298 | bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits); | ||
1299 | sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits); | ||
1285 | 1300 | ||
1286 | osb->sb = sb; | 1301 | osb->sb = sb; |
1287 | /* Save off for ocfs2_rw_direct */ | 1302 | /* Save off for ocfs2_rw_direct */ |
@@ -1341,8 +1356,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1341 | goto bail; | 1356 | goto bail; |
1342 | } | 1357 | } |
1343 | 1358 | ||
1344 | di = (struct ocfs2_dinode *)bh->b_data; | ||
1345 | |||
1346 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); | 1359 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); |
1347 | if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { | 1360 | if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { |
1348 | mlog(ML_ERROR, "Invalid number of node slots (%u)\n", | 1361 | mlog(ML_ERROR, "Invalid number of node slots (%u)\n", |
diff --git a/fs/ocfs2/super.h b/fs/ocfs2/super.h index 3b9cb3d0b008..783f5270f2a1 100644 --- a/fs/ocfs2/super.h +++ b/fs/ocfs2/super.h | |||
@@ -45,6 +45,4 @@ void __ocfs2_abort(struct super_block *sb, | |||
45 | 45 | ||
46 | #define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) | 46 | #define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) |
47 | 47 | ||
48 | unsigned long long ocfs2_max_file_offset(unsigned int blockshift); | ||
49 | |||
50 | #endif /* OCFS2_SUPER_H */ | 48 | #endif /* OCFS2_SUPER_H */ |
diff --git a/fs/signalfd.c b/fs/signalfd.c index 7b941abbcde0..a8e293d30034 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -56,12 +56,18 @@ static int signalfd_lock(struct signalfd_ctx *ctx, struct signalfd_lockctx *lk) | |||
56 | sighand = lock_task_sighand(lk->tsk, &lk->flags); | 56 | sighand = lock_task_sighand(lk->tsk, &lk->flags); |
57 | rcu_read_unlock(); | 57 | rcu_read_unlock(); |
58 | 58 | ||
59 | if (sighand && !ctx->tsk) { | 59 | if (!sighand) |
60 | return 0; | ||
61 | |||
62 | if (!ctx->tsk) { | ||
60 | unlock_task_sighand(lk->tsk, &lk->flags); | 63 | unlock_task_sighand(lk->tsk, &lk->flags); |
61 | sighand = NULL; | 64 | return 0; |
62 | } | 65 | } |
63 | 66 | ||
64 | return sighand != NULL; | 67 | if (lk->tsk->tgid == current->tgid) |
68 | lk->tsk = current; | ||
69 | |||
70 | return 1; | ||
65 | } | 71 | } |
66 | 72 | ||
67 | static void signalfd_unlock(struct signalfd_lockctx *lk) | 73 | static void signalfd_unlock(struct signalfd_lockctx *lk) |
@@ -331,7 +337,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
331 | 337 | ||
332 | init_waitqueue_head(&ctx->wqh); | 338 | init_waitqueue_head(&ctx->wqh); |
333 | ctx->sigmask = sigmask; | 339 | ctx->sigmask = sigmask; |
334 | ctx->tsk = current; | 340 | ctx->tsk = current->group_leader; |
335 | 341 | ||
336 | sighand = current->sighand; | 342 | sighand = current->sighand; |
337 | /* | 343 | /* |