Loading hw/9pfs/codir.c +9 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,12 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp) err = 0; } }); if (!err) { total_open_fd++; if (total_open_fd > open_fd_hw) { v9fs_reclaim_fd(s); } } return err; } Loading @@ -111,5 +117,8 @@ int v9fs_co_closedir(V9fsState *s, DIR *dir) err = -errno; } }); if (!err) { total_open_fd--; } return err; } hw/9pfs/virtio-9p.c +29 −2 Original line number Diff line number Diff line Loading @@ -266,6 +266,16 @@ static V9fsFidState *get_fid(V9fsState *s, int32_t fid) return NULL; } } } else if (f->fid_type == P9_FID_DIR) { if (f->fs.dir == NULL) { do { err = v9fs_co_opendir(s, f); } while (err == -EINTR); if (err < 0) { f->ref--; return NULL; } } } /* * Mark the fid as referenced so that the LRU Loading Loading @@ -348,7 +358,9 @@ static int free_fid(V9fsState *s, V9fsFidState *fidp) retval = v9fs_co_close(s, fidp->fs.fd); } } else if (fidp->fid_type == P9_FID_DIR) { if (fidp->fs.dir != NULL) { retval = v9fs_co_closedir(s, fidp->fs.dir); } } else if (fidp->fid_type == P9_FID_XATTR) { retval = v9fs_xattr_fid_clunk(s, fidp); } Loading Loading @@ -429,6 +441,19 @@ void v9fs_reclaim_fd(V9fsState *s) f->fs.fd = -1; reclaim_count++; } } else if (f->fid_type == P9_FID_DIR) { if (f->fs.dir != NULL) { /* * Up the reference count so that * a clunk request won't free this fid */ f->ref++; f->rclm_lst = reclaim_list; reclaim_list = f; f->fs_reclaim.dir = f->fs.dir; f->fs.dir = NULL; reclaim_count++; } } if (reclaim_count >= open_fd_rc) { break; Loading @@ -443,6 +468,8 @@ void v9fs_reclaim_fd(V9fsState *s) reclaim_list = f->rclm_lst; if (f->fid_type == P9_FID_FILE) { v9fs_co_close(s, f->fs_reclaim.fd); } else if (f->fid_type == P9_FID_DIR) { v9fs_co_closedir(s, f->fs_reclaim.dir); } f->rclm_lst = NULL; /* Loading Loading
hw/9pfs/codir.c +9 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,12 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp) err = 0; } }); if (!err) { total_open_fd++; if (total_open_fd > open_fd_hw) { v9fs_reclaim_fd(s); } } return err; } Loading @@ -111,5 +117,8 @@ int v9fs_co_closedir(V9fsState *s, DIR *dir) err = -errno; } }); if (!err) { total_open_fd--; } return err; }
hw/9pfs/virtio-9p.c +29 −2 Original line number Diff line number Diff line Loading @@ -266,6 +266,16 @@ static V9fsFidState *get_fid(V9fsState *s, int32_t fid) return NULL; } } } else if (f->fid_type == P9_FID_DIR) { if (f->fs.dir == NULL) { do { err = v9fs_co_opendir(s, f); } while (err == -EINTR); if (err < 0) { f->ref--; return NULL; } } } /* * Mark the fid as referenced so that the LRU Loading Loading @@ -348,7 +358,9 @@ static int free_fid(V9fsState *s, V9fsFidState *fidp) retval = v9fs_co_close(s, fidp->fs.fd); } } else if (fidp->fid_type == P9_FID_DIR) { if (fidp->fs.dir != NULL) { retval = v9fs_co_closedir(s, fidp->fs.dir); } } else if (fidp->fid_type == P9_FID_XATTR) { retval = v9fs_xattr_fid_clunk(s, fidp); } Loading Loading @@ -429,6 +441,19 @@ void v9fs_reclaim_fd(V9fsState *s) f->fs.fd = -1; reclaim_count++; } } else if (f->fid_type == P9_FID_DIR) { if (f->fs.dir != NULL) { /* * Up the reference count so that * a clunk request won't free this fid */ f->ref++; f->rclm_lst = reclaim_list; reclaim_list = f; f->fs_reclaim.dir = f->fs.dir; f->fs.dir = NULL; reclaim_count++; } } if (reclaim_count >= open_fd_rc) { break; Loading @@ -443,6 +468,8 @@ void v9fs_reclaim_fd(V9fsState *s) reclaim_list = f->rclm_lst; if (f->fid_type == P9_FID_FILE) { v9fs_co_close(s, f->fs_reclaim.fd); } else if (f->fid_type == P9_FID_DIR) { v9fs_co_closedir(s, f->fs_reclaim.dir); } f->rclm_lst = NULL; /* Loading