From: Linus Torvalds Date: Tue, 10 Jun 2014 02:08:43 +0000 (-0700) Subject: Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b1cce8032f6abe900b078d24f3c3938726528f97;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 Pull CIFS fixes from Steve French. * 'for-next' of git://git.samba.org/sfrench/cifs-2.6: CIFS: Fix memory leaks in SMB2_open cifs: ensure that vol->username is not NULL before running strlen on it Clarify SMB2/SMB3 create context and add missing ones Do not send ClientGUID on SMB2.02 dialect cifs: Set client guid on per connection basis fs/cifs/netmisc.c: convert printk to pr_foo() fs/cifs/cifs.c: replace seq_printf by seq_puts Update cifs version number to 2.03 fs: cifs: new helper: file_inode(file) cifs: fix potential races in cifs_revalidate_mapping cifs: new helper function: cifs_revalidate_mapping cifs: convert booleans in cifsInodeInfo to a flags field cifs: fix cifs_uniqueid_to_ino_t not to ever return 0 --- b1cce8032f6abe900b078d24f3c3938726528f97 diff --cc fs/cifs/inode.c index a22d667f1069,9ff8df8b4d84..a174605f6afa --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@@ -1776,6 -1775,50 +1775,50 @@@ cifs_invalidate_mapping(struct inode *i return rc; } + /** + * cifs_wait_bit_killable - helper for functions that are sleeping on bit locks + * @word: long word containing the bit lock + */ + static int + cifs_wait_bit_killable(void *word) + { + if (fatal_signal_pending(current)) + return -ERESTARTSYS; + freezable_schedule_unsafe(); + return 0; + } + + int + cifs_revalidate_mapping(struct inode *inode) + { + int rc; + unsigned long *flags = &CIFS_I(inode)->flags; + + rc = wait_on_bit_lock(flags, CIFS_INO_LOCK, cifs_wait_bit_killable, + TASK_KILLABLE); + if (rc) + return rc; + + if (test_and_clear_bit(CIFS_INO_INVALID_MAPPING, flags)) { + rc = cifs_invalidate_mapping(inode); + if (rc) + set_bit(CIFS_INO_INVALID_MAPPING, flags); + } + + clear_bit_unlock(CIFS_INO_LOCK, flags); - smp_mb__after_clear_bit(); ++ smp_mb__after_atomic(); + wake_up_bit(flags, CIFS_INO_LOCK); + + return rc; + } + + int + cifs_zap_mapping(struct inode *inode) + { + set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags); + return cifs_revalidate_mapping(inode); + } + int cifs_revalidate_file_attr(struct file *filp) { int rc = 0;