Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 361777
b: refs/heads/master
c: 2402867
h: refs/heads/master
i:
  361775: c90a367
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 21, 2013
1 parent 6dcdf29 commit e6e799b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24956804349ca0eadcdde032d65e8c00b4214096
refs/heads/master: 240286725d854331422cb15957f8d9bf2741d4e3
2 changes: 1 addition & 1 deletion trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2632,7 +2632,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
int status;

if (pnfs_ld_layoutret_on_setattr(inode))
pnfs_return_layout(inode);
pnfs_commit_and_return_layout(inode);

nfs_fattr_init(fattr);

Expand Down
27 changes: 27 additions & 0 deletions trunk/fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,33 @@ _pnfs_return_layout(struct inode *ino)
}
EXPORT_SYMBOL_GPL(_pnfs_return_layout);

int
pnfs_commit_and_return_layout(struct inode *inode)
{
struct pnfs_layout_hdr *lo;
int ret;

spin_lock(&inode->i_lock);
lo = NFS_I(inode)->layout;
if (lo == NULL) {
spin_unlock(&inode->i_lock);
return 0;
}
pnfs_get_layout_hdr(lo);
/* Block new layoutgets and read/write to ds */
lo->plh_block_lgets++;
spin_unlock(&inode->i_lock);
filemap_fdatawait(inode->i_mapping);
ret = pnfs_layoutcommit_inode(inode, true);
if (ret == 0)
ret = _pnfs_return_layout(inode);
spin_lock(&inode->i_lock);
lo->plh_block_lgets--;
spin_unlock(&inode->i_lock);
pnfs_put_layout_hdr(lo);
return ret;
}

bool pnfs_roc(struct inode *ino)
{
struct pnfs_layout_hdr *lo;
Expand Down
6 changes: 6 additions & 0 deletions trunk/fs/nfs/pnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void pnfs_set_layoutcommit(struct nfs_write_data *wdata);
void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data);
int pnfs_layoutcommit_inode(struct inode *inode, bool sync);
int _pnfs_return_layout(struct inode *);
int pnfs_commit_and_return_layout(struct inode *);
void pnfs_ld_write_done(struct nfs_write_data *);
void pnfs_ld_read_done(struct nfs_read_data *);
struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
Expand Down Expand Up @@ -407,6 +408,11 @@ static inline int pnfs_return_layout(struct inode *ino)
return 0;
}

static inline int pnfs_commit_and_return_layout(struct inode *inode)
{
return 0;
}

static inline bool
pnfs_ld_layoutret_on_setattr(struct inode *inode)
{
Expand Down

0 comments on commit e6e799b

Please sign in to comment.