|
8 | 8 | cases as published by the Free Software Foundation.
|
9 | 9 | */
|
10 | 10 |
|
| 11 | +#include <fcntl.h> |
11 | 12 | #include <glusterfs/compat.h>
|
12 | 13 | #include "dht-common.h"
|
13 | 14 |
|
@@ -45,7 +46,7 @@ dht_linkfile_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
45 | 46 |
|
46 | 47 | static int
|
47 | 48 | dht_linkfile_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
48 |
| - int op_ret, int op_errno, inode_t *inode, |
| 49 | + int op_ret, int op_errno, fd_t *fd, inode_t *inode, |
49 | 50 | struct iatt *stbuf, struct iatt *preparent,
|
50 | 51 | struct iatt *postparent, dict_t *xdata)
|
51 | 52 | {
|
@@ -147,9 +148,15 @@ dht_linkfile_create(call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
|
147 | 148 | /* Always create as root:root. dht_linkfile_attr_heal fixes the
|
148 | 149 | * ownsership */
|
149 | 150 | FRAME_SU_DO(frame, dht_local_t);
|
| 151 | + |
| 152 | + if (!local->fd) { |
| 153 | + local->fd = fd_create(loc->inode, frame->root->pid); |
| 154 | + local->flags |= (O_CREAT | O_EXCL); |
| 155 | + } |
| 156 | + |
150 | 157 | STACK_WIND_COOKIE(frame, dht_linkfile_create_cbk, fromvol, fromvol,
|
151 |
| - fromvol->fops->mknod, loc, S_IFREG | DHT_LINKFILE_MODE, 0, |
152 |
| - 0, dict); |
| 158 | + fromvol->fops->create, loc, local->flags, |
| 159 | + S_IFREG | DHT_LINKFILE_MODE, 0, local->fd, dict); |
153 | 160 |
|
154 | 161 | if (need_unref && dict)
|
155 | 162 | dict_unref(dict);
|
|
0 commit comments