- Timestamp:
- Mar 31, 2019 7:28:43 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77966 r77967 540 540 { 541 541 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 6) 542 return !list_empty( mapping->i_mmap_shared);542 return !list_empty(&mapping->i_mmap_shared); 543 543 # else 544 544 return mapping->i_mmap_shared != NULL; … … 1301 1301 Assert((ssize_t)cPages >= 0); 1302 1302 if (fSetDirty && !PageReserved(pPage)) 1303 SetPageDirty(pPage);1303 set_page_dirty(pPage); 1304 1304 vbsf_put_page(pPage); 1305 1305 } … … 1581 1581 * the error. (Not sure if this is such a great idea...) 1582 1582 */ 1583 if (cbRet > 0) 1583 if (cbRet > 0) { 1584 SFLOGFLOW(("vbsf_reg_read: read at %#RX64 -> %Rrc; got cbRet=%#zx already\n", offFile, rc, cbRet)); 1584 1585 *off = offFile; 1585 else 1586 } else { 1587 SFLOGFLOW(("vbsf_reg_read: read at %#RX64 -> %Rrc\n", offFile, rc)); 1586 1588 cbRet = -EPROTO; 1589 } 1587 1590 break; 1588 1591 } … … 1888 1891 * the error. (Not sure if this is such a great idea...) 1889 1892 */ 1890 if (cbRet > 0) 1893 if (cbRet > 0) { 1894 SFLOGFLOW(("vbsf_reg_write: write at %#RX64 -> %Rrc; got cbRet=%#zx already\n", offFile, rc, cbRet)); 1891 1895 *off = offFile; 1892 else 1896 } else { 1897 SFLOGFLOW(("vbsf_reg_write: write at %#RX64 -> %Rrc\n", offFile, rc)); 1893 1898 cbRet = -EPROTO; 1899 } 1894 1900 break; 1895 1901 } … … 2058 2064 struct page *pPage = papPages[cPages]; 2059 2065 if (fSetDirty && !PageReserved(pPage)) 2060 SetPageDirty(pPage);2066 set_page_dirty(pPage); 2061 2067 vbsf_put_page(pPage); 2062 2068 } … … 3073 3079 if (sf_r) { 3074 3080 struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb); 3081 struct address_space *mapping = inode->i_mapping; 3075 3082 Assert(pSuperInfo); 3076 3083 3084 /* If we're closing the last handle for this inode, make sure the flush 3085 the mapping or we'll end up in vbsf_writepage without a handle. */ 3086 if ( mapping 3087 && mapping->nrpages > 0 3088 /** @todo && last writable handle */ ) { 3077 3089 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25) 3078 /* See the smbfs source (file.c). mmap in particular can cause data to be 3079 * written to the file after it is closed, which we can't cope with. We 3080 * copy and paste the body of filemap_write_and_wait() here as it was not 3081 * defined before 2.6.6 and not exported until quite a bit later. */ 3082 /* filemap_write_and_wait(inode->i_mapping); */ 3083 if (inode->i_mapping->nrpages 3084 && filemap_fdatawrite(inode->i_mapping) != -EIO) 3085 filemap_fdatawait(inode->i_mapping); 3086 #endif 3090 if (filemap_fdatawrite(mapping) != -EIO) 3091 #else 3092 if ( filemap_fdatasync(mapping) == 0 3093 && fsync_inode_data_buffers(inode) == 0) 3094 #endif 3095 filemap_fdatawait(inode->i_mapping); 3096 } 3087 3097 3088 3098 /* Release sf_r, closing the handle if we're the last user. */ … … 3179 3189 } 3180 3190 # else /* < 2.5.12 */ 3181 rc = fsync_inode_buffers(inode); 3191 /** @todo 3192 * Somethings is buggy here or in the 2.4.21-27.EL kernel I'm testing on. 3193 * 3194 * In theory we shouldn't need to do anything here, since msync will call 3195 * writepage() on each dirty page and we write them out synchronously. So, the 3196 * problem is elsewhere... Doesn't happen all the time either. Sigh. 3197 */ 3198 rc = fsync_inode_buffers(inode); 3182 3199 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 10) 3183 rc |= fsync_inode_data_buffers(inode); 3200 if (rc == 0 && datasync) 3201 rc = fsync_inode_data_buffers(inode); 3184 3202 # endif 3185 /** @todo probably need to do more here... */ 3203 3186 3204 # endif /* < 2.5.12 */ 3187 3205 return rc; … … 3607 3625 i_size_write(inode, offEndOfWrite); 3608 3626 3627 /* Update and unlock the page. */ 3609 3628 if (PageError(page)) 3610 3629 ClearPageError(page); 3611 3612 err = 0;3613 } else { 3614 ClearPageUptodate(page);3615 err = -EPROTO;3630 SetPageUptodate(page); 3631 unlock_page(page); 3632 3633 vbsf_handle_release(pHandle, pSuperInfo, "vbsf_writepage"); 3634 return 0; 3616 3635 } 3636 3637 /* 3638 * We failed. 3639 */ 3640 err = -EIO; 3617 3641 } else 3618 3642 err = -ENOMEM; 3619 3643 vbsf_handle_release(pHandle, pSuperInfo, "vbsf_writepage"); 3620 3644 } else { 3645 /** @todo we could re-open the file here and deal with this... */ 3621 3646 static uint64_t volatile s_cCalls = 0; 3622 3647 if (s_cCalls++ < 16) 3623 3648 printk("vbsf_writepage: no writable handle for %s..\n", sf_i->path->String.ach); 3624 SetPageError(page);3625 err = -EPROTO;3626 }3649 err = -EIO; 3650 } 3651 SetPageError(page); 3627 3652 unlock_page(page); 3628 3653 return err; … … 3646 3671 (unsigned long long)pos, len, flags); 3647 3672 RTLogBackdoorPrintf("vboxsf: Unexpected call to vbsf_write_begin(pos=%#llx len=%#x flags=%#x)! Please report.\n", 3648 (unsigned long long)pos, len, flags);3673 (unsigned long long)pos, len, flags); 3649 3674 # ifdef WARN_ON 3650 3675 WARN_ON(1);
Note:
See TracChangeset
for help on using the changeset viewer.