Changeset 77976 in vbox for trunk/src/VBox/Additions/linux/sharedfolders
- Timestamp:
- Apr 1, 2019 11:12:02 AM (6 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r77975 r77976 1863 1863 1864 1864 cbRet += cbActual; 1865 offFile += cbActual;1866 1865 buf = (uint8_t *)buf + cbActual; 1867 1866 size -= cbActual; 1867 1868 offFile += cbActual; 1869 if ((file->f_flags & O_APPEND) && (g_fSfFeatures & SHFL_FEATURE_WRITE_UPDATES_OFFSET)) 1870 offFile = pReq->Parms.off64Write.u.value64; 1868 1871 if (offFile > i_size_read(inode)) 1869 1872 i_size_write(inode, offFile); 1873 1870 1874 sf_i->force_restat = 1; /* mtime (and size) may have changed */ 1871 1875 … … 1937 1941 1938 1942 pos = *off; 1939 /** @todo This should be handled by the host, it returning the new file1940 * offset when appending. We may have an outdated i_size value here! */1941 1943 if (file->f_flags & O_APPEND) 1942 1944 pos = i_size_read(inode); … … 1988 1990 NULL /*papSrcPages*/, 0 /*offSrcPage0*/, 0 /*cSrcPages*/); 1989 1991 pos += cbRet; 1992 if ((file->f_flags & O_APPEND) && (g_fSfFeatures & SHFL_FEATURE_WRITE_UPDATES_OFFSET)) 1993 pos = pReq->Parms.off64Write.u.value64; 1990 1994 *off = pos; 1991 1995 if (pos > i_size_read(inode)) … … 2630 2634 */ 2631 2635 static ssize_t vbsf_reg_write_iter_locking(struct kiocb *kio, struct iov_iter *iter, size_t cbToWrite, loff_t offFile, 2632 struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r, 2633 struct inode *inode, struct vbsf_inode_info *sf_i, struct address_space *mapping)2636 struct vbsf_super_info *pSuperInfo, struct vbsf_reg_info *sf_r, struct inode *inode, 2637 struct vbsf_inode_info *sf_i, struct address_space *mapping, bool fAppend) 2634 2638 { 2635 2639 /* … … 2697 2701 2698 2702 cbRet += cbActual; 2703 cbToWrite -= cbActual; 2704 2699 2705 offFile += cbActual; 2706 if (fAppend && (g_fSfFeatures & SHFL_FEATURE_WRITE_UPDATES_OFFSET)) 2707 offFile = pReq->Parms.off64Write.u.value64; 2700 2708 kio->ki_pos = offFile; 2701 cbToWrite -= cbActual;2702 2709 if (offFile > i_size_read(inode)) 2703 2710 i_size_write(inode, offFile); 2711 2704 2712 sf_i->force_restat = 1; /* mtime (and size) may have changed */ 2705 2713 … … 2780 2788 loff_t offFile = kio->ki_pos; 2781 2789 # endif 2790 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) 2791 bool const fAppend = RT_BOOL(kio->ki_flags & IOCB_APPEND); 2792 # else 2793 bool const fAppend = RT_BOOL(kio->ki_filp->f_flags & O_APPEND); 2794 # endif 2795 2782 2796 2783 2797 SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", … … 2786 2800 2787 2801 /* 2788 * Enforce APPEND flag .2802 * Enforce APPEND flag (more later). 2789 2803 */ 2790 /** @todo This should be handled by the host, it returning the new file 2791 * offset when appending. We may have an outdated i_size value here! */ 2792 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) 2793 if (kio->ki_flags & IOCB_APPEND) 2794 # else 2795 if (kio->ki_filp->f_flags & O_APPEND) 2796 # endif 2804 if (fAppend) 2797 2805 kio->ki_pos = offFile = i_size_read(inode); 2798 2806 … … 2848 2856 vbsf_reg_write_sync_page_cache(mapping, offFile, (uint32_t)cbRet, pReq->abData, 2849 2857 NULL /*papSrcPages*/, 0 /*offSrcPage0*/, 0 /*cSrcPages*/); 2850 kio->ki_pos = offFile += cbRet; 2858 2859 offFile += cbRet; 2860 if (fAppend && (g_fSfFeatures & SHFL_FEATURE_WRITE_UPDATES_OFFSET)) 2861 offFile = pReq->Parms.off64Write.u.value64; 2862 kio->ki_pos = offFile; 2851 2863 if (offFile > i_size_read(inode)) 2852 2864 i_size_write(inode, offFile); 2865 2853 2866 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) 2854 2867 if ((size_t)cbRet < cbToWrite) … … 2871 2884 * Otherwise do the page locking thing. 2872 2885 */ 2873 return vbsf_reg_write_iter_locking(kio, iter, cbToWrite, offFile, pSuperInfo, sf_r, inode, sf_i, mapping );2886 return vbsf_reg_write_iter_locking(kio, iter, cbToWrite, offFile, pSuperInfo, sf_r, inode, sf_i, mapping, fAppend); 2874 2887 } 2875 2888 … … 3033 3046 if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL) { 3034 3047 vbsf_dentry_chain_increase_ttl(dentry); 3048 vbsf_update_inode(inode, sf_i, &pReq->CreateParms.Info, pSuperInfo, false /*fInodeLocked*/, 0 /*fSetAttrs*/); 3035 3049 rc_linux = 0; 3036 3050 } else { 3037 3051 switch (pReq->CreateParms.Result) { 3038 3052 case SHFL_PATH_NOT_FOUND: 3053 vbsf_dentry_invalidate_ttl(dentry); 3039 3054 rc_linux = -ENOENT; 3040 3055 break; 3041 3056 case SHFL_FILE_NOT_FOUND: 3057 vbsf_dentry_invalidate_ttl(dentry); 3042 3058 /** @todo sf_dentry_increase_parent_ttl(file->f_dentry); if we can trust it. */ 3043 3059 rc_linux = -ENOENT; … … 3045 3061 case SHFL_FILE_EXISTS: 3046 3062 vbsf_dentry_chain_increase_ttl(dentry); 3063 vbsf_update_inode(inode, sf_i, &pReq->CreateParms.Info, pSuperInfo, false /*fInodeLocked*/, 0 /*fSetAttrs*/); 3047 3064 rc_linux = -EEXIST; 3048 3065 break; … … 3054 3071 } 3055 3072 3056 /** @todo update the inode here, pReq carries the latest stats! Very helpful3057 * for detecting host side changes. */3058 3059 sf_i->force_restat = 1; /** @todo Why?!? */3060 3073 sf_r->Handle.hHost = pReq->CreateParms.Handle; 3061 3074 file->private_data = sf_r; -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r77960 r77976 71 71 /** Last valid shared folders function number. */ 72 72 uint32_t g_uSfLastFunction = SHFL_FN_SET_FILE_SIZE; 73 /** Shared folders features . */73 /** Shared folders features (SHFL_FEATURE_XXX). */ 74 74 uint64_t g_fSfFeatures = 0; 75 75
Note:
See TracChangeset
for help on using the changeset viewer.