@@ -175,12 +175,9 @@ struct cb_devicenotifyitem {
uint32_t cbd_immediate;
};
-/* XXX: Should be dynamic up to max compound size */
-#define NFS4_DEV_NOTIFY_MAXENTRIES 10
struct cb_devicenotifyargs {
- struct sockaddr *addr;
int ndevs;
- struct cb_devicenotifyitem devs[NFS4_DEV_NOTIFY_MAXENTRIES];
+ struct cb_devicenotifyitem *devs;
};
extern __be32 nfs4_callback_devicenotify(
@@ -286,6 +286,7 @@ __be32 nfs4_callback_devicenotify(struct
cb_devicenotifyargs *args,
}
out:
+ kfree(args->devs);
dprintk("%s: exit with status = %u\n",
__func__, res);
return cpu_to_be32(res);
@@ -296,23 +296,20 @@ __be32 decode_devicenotify_args(struct svc_rqst
*rqstp,
int n, i;
args->ndevs = 0;
- args->addr = svc_addr(rqstp);
-
/* Num of device notifications */
p = read_buf(xdr, sizeof(uint32_t));
if (unlikely(p == NULL)) {
- status = htonl(NFS4ERR_RESOURCE);
+ status = htonl(NFS4ERR_BADXDR);
goto out;
}
n = ntohl(*p++);
if (n <= 0)
goto out;
- /* XXX: need to possibly return error in this case */
- if (n > NFS4_DEV_NOTIFY_MAXENTRIES) {
- dprintk("%s: Processing (%d) notifications out of (%d)\n",
- __func__, NFS4_DEV_NOTIFY_MAXENTRIES, n);
- n = NFS4_DEV_NOTIFY_MAXENTRIES;
+ args->devs = kmalloc(n * sizeof(*args->devs), GFP_KERNEL);
+ if (!args->devs) {
+ status = htonl(NFS4ERR_DELAY);
+ goto out;
}