diff options
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index df9c9141c099..5be1f997ecde 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -253,6 +253,11 @@ cifs_alloc_inode(struct super_block *sb) | |||
253 | cifs_set_oplock_level(cifs_inode, 0); | 253 | cifs_set_oplock_level(cifs_inode, 0); |
254 | cifs_inode->delete_pending = false; | 254 | cifs_inode->delete_pending = false; |
255 | cifs_inode->invalid_mapping = false; | 255 | cifs_inode->invalid_mapping = false; |
256 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cifs_inode->flags); | ||
257 | clear_bit(CIFS_INODE_PENDING_WRITERS, &cifs_inode->flags); | ||
258 | clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, &cifs_inode->flags); | ||
259 | spin_lock_init(&cifs_inode->writers_lock); | ||
260 | cifs_inode->writers = 0; | ||
256 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ | 261 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ |
257 | cifs_inode->server_eof = 0; | 262 | cifs_inode->server_eof = 0; |
258 | cifs_inode->uniqueid = 0; | 263 | cifs_inode->uniqueid = 0; |
@@ -732,19 +737,26 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
732 | unsigned long nr_segs, loff_t pos) | 737 | unsigned long nr_segs, loff_t pos) |
733 | { | 738 | { |
734 | struct inode *inode = file_inode(iocb->ki_filp); | 739 | struct inode *inode = file_inode(iocb->ki_filp); |
740 | struct cifsInodeInfo *cinode = CIFS_I(inode); | ||
735 | ssize_t written; | 741 | ssize_t written; |
736 | int rc; | 742 | int rc; |
737 | 743 | ||
744 | written = cifs_get_writer(cinode); | ||
745 | if (written) | ||
746 | return written; | ||
747 | |||
738 | written = generic_file_aio_write(iocb, iov, nr_segs, pos); | 748 | written = generic_file_aio_write(iocb, iov, nr_segs, pos); |
739 | 749 | ||
740 | if (CIFS_CACHE_WRITE(CIFS_I(inode))) | 750 | if (CIFS_CACHE_WRITE(CIFS_I(inode))) |
741 | return written; | 751 | goto out; |
742 | 752 | ||
743 | rc = filemap_fdatawrite(inode->i_mapping); | 753 | rc = filemap_fdatawrite(inode->i_mapping); |
744 | if (rc) | 754 | if (rc) |
745 | cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n", | 755 | cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n", |
746 | rc, inode); | 756 | rc, inode); |
747 | 757 | ||
758 | out: | ||
759 | cifs_put_writer(cinode); | ||
748 | return written; | 760 | return written; |
749 | } | 761 | } |
750 | 762 | ||