mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
1983a66f57
We currently can hit a deadlock (of sorts) when trying to use flexfiles layouts with XFS. XFS will call break_layout when something wants to write to the file. In the case of the (super-simple) flexfiles layout driver in knfsd, the MDS and DS are the same machine. The client can get a layout and then issue a v3 write to do its I/O. XFS will then call xfs_break_layouts, which will cause a CB_LAYOUTRECALL to be issued to the client. The client however can't return the layout until the v3 WRITE completes, but XFS won't allow the write to proceed until the layout is returned. Christoph says: XFS only cares about block-like layouts where the client has direct access to the file blocks. I'd need to look how to propagate the flag into break_layout, but in principle we don't need to do any recalls on truncate ever for file and flexfile layouts. If we're never going to recall the layout, then we don't even need to set the lease at all. Just skip doing so on flexfiles layouts by adding a new flag to struct nfsd4_layout_ops and skipping the lease setting and removal when that flag is true. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
100 lines
2.7 KiB
C
100 lines
2.7 KiB
C
#ifndef _FS_NFSD_PNFS_H
|
|
#define _FS_NFSD_PNFS_H 1
|
|
|
|
#ifdef CONFIG_NFSD_V4
|
|
#include <linux/exportfs.h>
|
|
#include <linux/nfsd/export.h>
|
|
|
|
#include "state.h"
|
|
#include "xdr4.h"
|
|
|
|
struct xdr_stream;
|
|
|
|
struct nfsd4_deviceid_map {
|
|
struct list_head hash;
|
|
u64 idx;
|
|
int fsid_type;
|
|
u32 fsid[];
|
|
};
|
|
|
|
struct nfsd4_layout_ops {
|
|
u32 notify_types;
|
|
bool disable_recalls;
|
|
|
|
__be32 (*proc_getdeviceinfo)(struct super_block *sb,
|
|
struct svc_rqst *rqstp,
|
|
struct nfs4_client *clp,
|
|
struct nfsd4_getdeviceinfo *gdevp);
|
|
__be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
|
|
struct nfsd4_getdeviceinfo *gdevp);
|
|
|
|
__be32 (*proc_layoutget)(struct inode *, const struct svc_fh *fhp,
|
|
struct nfsd4_layoutget *lgp);
|
|
__be32 (*encode_layoutget)(struct xdr_stream *,
|
|
struct nfsd4_layoutget *lgp);
|
|
|
|
__be32 (*proc_layoutcommit)(struct inode *inode,
|
|
struct nfsd4_layoutcommit *lcp);
|
|
|
|
void (*fence_client)(struct nfs4_layout_stateid *ls);
|
|
};
|
|
|
|
extern const struct nfsd4_layout_ops *nfsd4_layout_ops[];
|
|
#ifdef CONFIG_NFSD_BLOCKLAYOUT
|
|
extern const struct nfsd4_layout_ops bl_layout_ops;
|
|
#endif
|
|
#ifdef CONFIG_NFSD_SCSILAYOUT
|
|
extern const struct nfsd4_layout_ops scsi_layout_ops;
|
|
#endif
|
|
#ifdef CONFIG_NFSD_FLEXFILELAYOUT
|
|
extern const struct nfsd4_layout_ops ff_layout_ops;
|
|
#endif
|
|
|
|
__be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp,
|
|
struct nfsd4_compound_state *cstate, stateid_t *stateid,
|
|
bool create, u32 layout_type, struct nfs4_layout_stateid **lsp);
|
|
__be32 nfsd4_insert_layout(struct nfsd4_layoutget *lgp,
|
|
struct nfs4_layout_stateid *ls);
|
|
__be32 nfsd4_return_file_layouts(struct svc_rqst *rqstp,
|
|
struct nfsd4_compound_state *cstate,
|
|
struct nfsd4_layoutreturn *lrp);
|
|
__be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
|
|
struct nfsd4_compound_state *cstate,
|
|
struct nfsd4_layoutreturn *lrp);
|
|
int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
|
|
u32 device_generation);
|
|
struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
|
|
#endif /* CONFIG_NFSD_V4 */
|
|
|
|
#ifdef CONFIG_NFSD_PNFS
|
|
void nfsd4_setup_layout_type(struct svc_export *exp);
|
|
void nfsd4_return_all_client_layouts(struct nfs4_client *);
|
|
void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
|
|
struct nfs4_file *fp);
|
|
int nfsd4_init_pnfs(void);
|
|
void nfsd4_exit_pnfs(void);
|
|
#else
|
|
struct nfs4_client;
|
|
struct nfs4_file;
|
|
|
|
static inline void nfsd4_setup_layout_type(struct svc_export *exp)
|
|
{
|
|
}
|
|
|
|
static inline void nfsd4_return_all_client_layouts(struct nfs4_client *clp)
|
|
{
|
|
}
|
|
static inline void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
|
|
struct nfs4_file *fp)
|
|
{
|
|
}
|
|
static inline void nfsd4_exit_pnfs(void)
|
|
{
|
|
}
|
|
static inline int nfsd4_init_pnfs(void)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_NFSD_PNFS */
|
|
#endif /* _FS_NFSD_PNFS_H */
|